[infrastructure] add external null-annotations (#8848)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
@@ -43,7 +43,10 @@ public class SensorId {
|
||||
* - characters are case-insensitive
|
||||
* - hubs ("1F.xxxxxxxxxxxx/aux/") may be repeated
|
||||
*/
|
||||
public SensorId(String fullPath) {
|
||||
public SensorId(@Nullable String fullPath) {
|
||||
if (fullPath == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
Matcher matcher = SENSOR_ID_PATTERN.matcher(fullPath);
|
||||
if (matcher.matches() && matcher.groupCount() == 2) {
|
||||
path = matcher.group(1) == null ? "" : matcher.group(1);
|
||||
|
||||
@@ -118,8 +118,8 @@ public class OwDiscoveryItem {
|
||||
* @return ThingTypeUID if mapping successful
|
||||
*/
|
||||
public ThingTypeUID getThingTypeUID() throws OwException {
|
||||
if (THING_TYPE_MAP.containsKey(sensorType)) {
|
||||
thingTypeUID = THING_TYPE_MAP.get(sensorType);
|
||||
ThingTypeUID thingTypeUID = THING_TYPE_MAP.get(sensorType);
|
||||
if (thingTypeUID != null) {
|
||||
return thingTypeUID;
|
||||
} else {
|
||||
throw new OwException(sensorType + " cannot be mapped to thing type");
|
||||
|
||||
@@ -90,17 +90,20 @@ public class AdvancedMultisensorThingHandler extends OwBaseThingHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
hwRevision = Integer.valueOf(properties.get(PROPERTY_HW_REVISION));
|
||||
hwRevision = Integer.valueOf(properties.getOrDefault(PROPERTY_HW_REVISION, "0"));
|
||||
|
||||
sensors.add(new DS2438(sensorId, this));
|
||||
sensors.add(new DS18x20(new SensorId(properties.get(PROPERTY_DS18B20)), this));
|
||||
if (THING_TYPE_AMS.equals(thingType)) {
|
||||
sensors.add(new DS2438(new SensorId(properties.get(PROPERTY_DS2438)), this));
|
||||
sensors.add(new DS2406_DS2413(new SensorId(properties.get(PROPERTY_DS2413)), this));
|
||||
digitalRefreshInterval = configuration.digitalRefresh * 1000;
|
||||
digitalLastRefresh = 0;
|
||||
try {
|
||||
sensors.add(new DS2438(sensorId, this));
|
||||
sensors.add(new DS18x20(new SensorId(properties.get(PROPERTY_DS18B20)), this));
|
||||
if (THING_TYPE_AMS.equals(thingType)) {
|
||||
sensors.add(new DS2438(new SensorId(properties.get(PROPERTY_DS2438)), this));
|
||||
sensors.add(new DS2406_DS2413(new SensorId(properties.get(PROPERTY_DS2413)), this));
|
||||
digitalRefreshInterval = configuration.digitalRefresh * 1000;
|
||||
digitalLastRefresh = 0;
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "properties invalid");
|
||||
}
|
||||
|
||||
scheduler.execute(() -> {
|
||||
configureThingChannels();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user