[infrastructure] add external null-annotations (#8848)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K
2020-10-31 00:29:03 +01:00
committed by GitHub
parent 47d05055db
commit bd664ff0c8
162 changed files with 933 additions and 575 deletions

View File

@@ -18,6 +18,7 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.thing.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,8 +36,8 @@ public class KM200Utils {
* Translates a service name to a service path (Replaces # through /)
*
*/
public static String translatesNameToPath(String name) {
return name.replace("#", "/");
public static @Nullable String translatesNameToPath(@Nullable String name) {
return name == null ? null : name.replace("#", "/");
}
/**

View File

@@ -436,10 +436,10 @@ public class KM200GatewayHandler extends BaseBridgeHandler {
if (null != tmpSerObjekt) {
if (parent == null || parent.equals(tmpSerObjekt.getParent())) {
synchronized (sendMap) {
if (sendMap.containsKey(actChannel)) {
state = dataHandler.parseJSONData(sendMap.get(actChannel),
tmpSerObjekt.getServiceType(), tmpService, actChTypes,
KM200Utils.getChannelConfigurationStrings(actChannel));
JsonObject obj = sendMap.get(actChannel);
if (obj != null) {
state = dataHandler.parseJSONData(obj, tmpSerObjekt.getServiceType(), tmpService,
actChTypes, KM200Utils.getChannelConfigurationStrings(actChannel));
} else {
state = dataHandler.getProvidersState(tmpService, actChTypes,
KM200Utils.getChannelConfigurationStrings(actChannel));
@@ -548,10 +548,10 @@ public class KM200GatewayHandler extends BaseBridgeHandler {
synchronized (sendMap) {
KM200ServiceObject serObjekt = remoteDevice.getServiceObject(service);
if (null != serObjekt) {
if (sendMap.containsKey(channel)) {
state = dataHandler.parseJSONData(sendMap.get(channel),
serObjekt.getServiceType(), service, chTypes,
KM200Utils.getChannelConfigurationStrings(channel));
JsonObject obj = sendMap.get(channel);
if (obj != null) {
state = dataHandler.parseJSONData(obj, serObjekt.getServiceType(), service,
chTypes, KM200Utils.getChannelConfigurationStrings(channel));
} else {
state = dataHandler.getProvidersState(service, chTypes,
KM200Utils.getChannelConfigurationStrings(channel));

View File

@@ -467,7 +467,10 @@ public class KM200ThingHandler extends BaseThingHandler {
continue;
}
/* Search for new services in sub path */
addChannels(serObj.serviceTreeMap.get(subKey), thing, subChannels, subKey + "_");
KM200ServiceObject obj = serObj.serviceTreeMap.get(subKey);
if (obj != null) {
addChannels(obj, thing, subChannels, subKey + "_");
}
break;
case DATA_TYPE_ERROR_LIST:
if ("nbrErrors".equals(subKey) || "error".equals(subKey)) {