[infrastructure] add external null-annotations (#8848)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
@@ -59,7 +59,7 @@ public class ShellyApiException extends Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
public @Nullable String getMessage() {
|
||||
return isEmpty() ? "" : nonNullString(super.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ public class ShellyCoIoTProtocol {
|
||||
Double brightness = -1.0;
|
||||
Double power = -1.0;
|
||||
for (CoIotSensor update : allUpdates) {
|
||||
CoIotDescrSen d = fixDescription(sensorMap.get(update.id), blkMap);
|
||||
CoIotDescrSen d = fixDescription(sensorMap.getOrDefault(update.id, new CoIotDescrSen()), blkMap);
|
||||
if (!checkL.isEmpty() && !d.links.equals(checkL)) {
|
||||
// continue until we find the correct one
|
||||
continue;
|
||||
|
||||
@@ -124,12 +124,13 @@ public class ShellyThingCreator {
|
||||
}
|
||||
|
||||
// Check general mapping
|
||||
if (!deviceType.isEmpty() && THING_TYPE_MAPPING.containsKey(deviceType)) {
|
||||
return THING_TYPE_MAPPING.get(deviceType);
|
||||
if (!deviceType.isEmpty()) {
|
||||
String str = THING_TYPE_MAPPING.get(deviceType);
|
||||
if (str != null) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
if (THING_TYPE_MAPPING.containsKey(type)) {
|
||||
return THING_TYPE_MAPPING.get(type);
|
||||
}
|
||||
return THING_TYPE_SHELLYUNKNOWN_STR;
|
||||
|
||||
return THING_TYPE_MAPPING.getOrDefault(type, THING_TYPE_SHELLYUNKNOWN_STR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,10 +120,7 @@ public class ShellyChannelCache {
|
||||
}
|
||||
|
||||
public State getValue(String channelId) {
|
||||
if (channelData.containsKey(channelId)) {
|
||||
return channelData.get(channelId);
|
||||
}
|
||||
return UnDefType.NULL;
|
||||
return channelData.getOrDefault(channelId, UnDefType.NULL);
|
||||
}
|
||||
|
||||
public void resetChannel(String channelId) {
|
||||
|
||||
Reference in New Issue
Block a user