[infrastructure] move infered nullness warnings to error and update EEA (#8949)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K
2020-11-12 21:07:11 +01:00
committed by GitHub
parent 0856a0b3f2
commit ba4c96d99d
155 changed files with 644 additions and 632 deletions

View File

@@ -54,15 +54,21 @@ public class KM200Utils {
*/
public static String checkParameterReplacement(Channel channel, KM200Device device) {
String service = KM200Utils.translatesNameToPath(channel.getProperties().get("root"));
if (service.contains(SWITCH_PROGRAM_REPLACEMENT)) {
String currentService = KM200Utils
.translatesNameToPath(channel.getProperties().get(SWITCH_PROGRAM_CURRENT_PATH_NAME));
if (service == null) {
LOGGER.warn("Root property not found in device {}", device);
throw new IllegalStateException("root property not found");
}
String currentService = KM200Utils
.translatesNameToPath(channel.getProperties().get(SWITCH_PROGRAM_CURRENT_PATH_NAME));
if (currentService != null) {
if (device.containsService(currentService)) {
KM200ServiceObject curSerObj = device.getServiceObject(currentService);
if (null != curSerObj) {
if (DATA_TYPE_STRING_VALUE.equals(curSerObj.getServiceType())) {
String val = (String) curSerObj.getValue();
service = service.replace(SWITCH_PROGRAM_REPLACEMENT, val);
if (val != null) {
service = service.replace(SWITCH_PROGRAM_REPLACEMENT, val);
}
return service;
}
}

View File

@@ -354,7 +354,7 @@ public class KM200SwitchProgramServiceHandler {
firstVal = (BigDecimal) setpObject.serviceTreeMap.get(key).getValue();
} else {
BigDecimal nextVal = (BigDecimal) setpObject.serviceTreeMap.get(key).getValue();
if (null != nextVal) {
if (null != nextVal && null != firstVal) {
if (nextVal.compareTo(firstVal) > 0) {
positiveSwitch = key;
} else {

View File

@@ -231,6 +231,10 @@ public class KM200ThingHandler extends BaseThingHandler {
return;
}
String service = KM200Utils.translatesNameToPath(thing.getProperties().get("root"));
if (service == null) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "root property missing");
return;
}
synchronized (gateway.getDevice()) {
updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.CONFIGURATION_PENDING);
if (!gateway.getDevice().getInited()) {
@@ -284,10 +288,14 @@ public class KM200ThingHandler extends BaseThingHandler {
state = StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.ZERO).withStep(BigDecimal.ONE)
.withPattern("%d minutes").build();
String posName = thing.getProperties().get(SWITCH_PROGRAM_POSITIVE);
newChannel = createChannel(new ChannelTypeUID(thing.getUID().getAsString() + ":" + posName),
new ChannelUID(thing.getUID(), posName), service + "/" + posName, CoreItemFactory.NUMBER,
currentPathName, "Positive switch of the cycle, like 'Day' 'On'", posName, true, true, state,
"minutes");
if (posName == null) {
newChannel = null;
} else {
newChannel = createChannel(new ChannelTypeUID(thing.getUID().getAsString() + ":" + posName),
new ChannelUID(thing.getUID(), posName), service + "/" + posName, CoreItemFactory.NUMBER,
currentPathName, "Positive switch of the cycle, like 'Day' 'On'", posName, true, true,
state, "minutes");
}
if (null == newChannel) {
logger.warn("Creation of the channel {} was not possible", thing.getUID());
} else {
@@ -295,10 +303,14 @@ public class KM200ThingHandler extends BaseThingHandler {
}
String negName = thing.getProperties().get(SWITCH_PROGRAM_NEGATIVE);
newChannel = createChannel(new ChannelTypeUID(thing.getUID().getAsString() + ":" + negName),
new ChannelUID(thing.getUID(), negName), service + "/" + negName, CoreItemFactory.NUMBER,
currentPathName, "Negative switch of the cycle, like 'Night' 'Off'", negName, true, true, state,
"minutes");
if (negName == null) {
newChannel = null;
} else {
newChannel = createChannel(new ChannelTypeUID(thing.getUID().getAsString() + ":" + negName),
new ChannelUID(thing.getUID(), negName), service + "/" + negName, CoreItemFactory.NUMBER,
currentPathName, "Negative switch of the cycle, like 'Night' 'Off'", negName, true, true,
state, "minutes");
}
if (null == newChannel) {
logger.warn("Creation of the channel {} was not possible", thing.getUID());
} else {