Fix SAT erros

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
Leo Siepel 2025-01-05 20:53:49 +01:00
parent b5203ebff4
commit 9f34cd7c6e
No known key found for this signature in database
GPG Key ID: E3035441D9FCD768
3 changed files with 15 additions and 14 deletions

View File

@ -185,6 +185,7 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
} else if ("durchsichtig".equals(classFlag)) { // link
this.fieldType = FieldType.IGNORE;
} else if ("bord".equals(classFlag)) { // special button style - not of our interest...
return;
} else {
logger.debug("Unhanndled class in {}:{}:{}: '{}' ", id, line, col, classFlag);
}
@ -192,7 +193,7 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
}
} else if (this.parserState == ParserState.DATA_ENTRY && this.fieldType == FieldType.BUTTON
&& "span".equals(elementName)) {
// ignored...
return; // ignored...
} else {
logger.debug("Unexpected OpenElement in {}:{}: {} [{}]", line, col, elementName, attributes);
}
@ -245,14 +246,14 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
getApiPageEntry(id, line, col, shortName, description, this.buttonValue);
}
} else if (this.fieldType == FieldType.IGNORE) {
// ignore
return; // ignore
} else {
logger.debug("Unhandled setting {}:{}:{} [{}] : {}", id, line, col, this.fieldType, sb);
}
}
} else if (this.parserState == ParserState.DATA_ENTRY && this.fieldType == FieldType.BUTTON
&& "span".equals(elementName)) {
// ignored...
return;// ignored...
} else {
logger.debug("Unexpected CloseElement in {}:{}: {}", line, col, elementName);
}
@ -307,7 +308,7 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
}
} else if (this.parserState == ParserState.INIT && ((len == 1 && buffer[offset] == '\n')
|| (len == 2 && buffer[offset] == '\r' && buffer[offset + 1] == '\n'))) {
// single newline - ignore/drop it...
return; // single newline - ignore/drop it...
} else {
String msg = new String(buffer, offset, len).replace("\n", "\\n").replace("\r", "\\r");
logger.debug("Unexpected Text {}:{}: ParserState: {} ({}) `{}`", line, col, parserState, len, msg);
@ -400,9 +401,9 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
// failed to get unit...
if ("Imp".equals(unitStr) || "€$".contains(unitStr)) {
// special case
unitData = taCmiSchemaHandler.SPECIAL_MARKER;
unitData = TACmiSchemaHandler.SPECIAL_MARKER;
} else {
unitData = taCmiSchemaHandler.NULL_MARKER;
unitData = TACmiSchemaHandler.NULL_MARKER;
logger.warn(
"Unhandled UoM '{}' - seen on channel {} '{}'; Message from QuantityType: {}",
valParts[1], shortName, description, iae.getMessage());
@ -410,12 +411,12 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
}
taCmiSchemaHandler.unitsCache.put(unitStr, unitData);
}
if (unitData == taCmiSchemaHandler.NULL_MARKER) {
if (unitData == TACmiSchemaHandler.NULL_MARKER) {
// no UoM mappable - just send value
channelType = "Number";
unit = null;
state = new DecimalType(bd);
} else if (unitData == taCmiSchemaHandler.SPECIAL_MARKER) {
} else if (unitData == TACmiSchemaHandler.SPECIAL_MARKER) {
// special handling for unknown UoM
if ("Imp".equals(unitStr)) { // Number of Pulses
// impulses - no idea how to map this to something useful here?

View File

@ -102,7 +102,7 @@ public class ChangerX2Parser extends AbstractSimpleMarkupHandler {
this.optionFieldName = attributes == null ? null : attributes.get("name");
} else if ((this.parserState == ParserState.INIT || this.parserState == ParserState.INPUT)
&& "br".equals(elementName)) {
// ignored
return; // ignored
} else if ((this.parserState == ParserState.INIT || this.parserState == ParserState.INPUT)
&& "input".equals(elementName) && "changeto".equals(id)) {
this.parserState = ParserState.INPUT_DATA;
@ -171,7 +171,6 @@ public class ChangerX2Parser extends AbstractSimpleMarkupHandler {
}
this.options.put(ChangerX2Entry.TIME_PERIOD_PARTS, timeParts);
} else {
logger.warn("Error parsing options for {}: Unhandled input field in {}:{}: {}", channelName, line,
col, attributes);
}
@ -218,7 +217,7 @@ public class ChangerX2Parser extends AbstractSimpleMarkupHandler {
}
}
} else if (this.parserState == ParserState.INPUT && "span".equals(elementName)) {
// span's are ignored...
return; // span's are ignored...
} else {
logger.debug("Error parsing options for {}: Unexpected CloseElement in {}:{}: {}", channelName, line, col,
elementName);
@ -275,10 +274,11 @@ public class ChangerX2Parser extends AbstractSimpleMarkupHandler {
sb.append(buffer, offset, len);
}
} else if (this.parserState == ParserState.INIT && len == 1 && buffer[offset] == '\n') {
// single newline - ignore/drop it...
return; // single newline - ignore/drop it...
} else if (this.parserState == ParserState.INPUT) {
// this is a label next to the value input field - we currently have no use for it so
// it's dropped...
return;
} else {
logger.debug("Error parsing options for {}: Unexpected Text {}:{}: (ctx: {} len: {}) '{}' ",
this.channelName, line, col, this.parserState, len, new String(buffer, offset, len));

View File

@ -90,9 +90,9 @@ public class TACmiSchemaHandler extends BaseThingHandler {
// this is the units lookup cache.
protected final Map<String, UnitAndType> unitsCache = new ConcurrentHashMap<>();
// marks an entry with known un-resolveable unit
protected final UnitAndType NULL_MARKER = new UnitAndType(Units.ONE, "");
protected static final UnitAndType NULL_MARKER = new UnitAndType(Units.ONE, "");
// marks an entry with special handling - i.e. 'Imp'
protected final UnitAndType SPECIAL_MARKER = new UnitAndType(Units.ONE, "s");
protected static final UnitAndType SPECIAL_MARKER = new UnitAndType(Units.ONE, "s");
public TACmiSchemaHandler(final Thing thing, final HttpClient httpClient,
final TACmiChannelTypeProvider channelTypeProvider) {