[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

@@ -106,44 +106,49 @@ public class CosemObjectFactory {
logger.trace("Received obisIdString {}, obisId: {}, values: {}", obisIdString, obisId, cosemStringValues);
CosemObject cosemObject = null;
if (obisLookupTableFixed.containsKey(reducedObisId)) {
cosemObject = getCosemObjectInternal(obisLookupTableFixed.get(reducedObisId), obisId, cosemStringValues);
CosemObjectType objectType = obisLookupTableFixed.get(reducedObisId);
if (objectType != null) {
logger.trace("Found obisId {} in the fixed lookup table", reducedObisId);
} else if (obisLookupTableMultipleFixed.containsKey(reducedObisId)) {
for (CosemObjectType cosemObjectType : obisLookupTableMultipleFixed.get(reducedObisId)) {
cosemObject = getCosemObjectInternal(cosemObjectType, obisId, cosemStringValues);
return getCosemObjectInternal(objectType, obisId, cosemStringValues);
}
List<CosemObjectType> objectTypeList = obisLookupTableMultipleFixed.get(reducedObisId);
if (objectTypeList != null) {
for (CosemObjectType cosemObjectType : objectTypeList) {
CosemObject cosemObject = getCosemObjectInternal(cosemObjectType, obisId, cosemStringValues);
if (cosemObject != null) {
logger.trace("Found obisId {} in the fixed lookup table", reducedObisId);
break;
return cosemObject;
}
}
} else if (obisLookupTableDynamic.containsKey(reducedObisId)) {
}
objectType = obisLookupTableDynamic.get(reducedObisId);
if (objectType != null) {
logger.trace("Found obisId {} in the dynamic lookup table", reducedObisId);
cosemObject = getCosemObjectInternal(obisLookupTableDynamic.get(reducedObisId), obisId, cosemStringValues);
} else if (obisLookupTableFixed.containsKey(reducedObisIdGroupE)) {
cosemObject = getCosemObjectInternal(obisLookupTableFixed.get(reducedObisIdGroupE), obisId,
cosemStringValues);
} else {
for (CosemObjectType obisMsgType : obisWildcardCosemTypeList) {
if (obisMsgType.obisId.equalsWildCard(reducedObisId)) {
cosemObject = getCosemObjectInternal(obisMsgType, obisId, cosemStringValues);
if (cosemObject != null) {
logger.trace("Searched reducedObisId {} in the wild card type list, result: {}", reducedObisId,
cosemObject);
obisLookupTableDynamic.put(reducedObisId, obisMsgType);
break;
}
return getCosemObjectInternal(objectType, obisId, cosemStringValues);
}
objectType = obisLookupTableFixed.get(reducedObisIdGroupE);
if (objectType != null) {
return getCosemObjectInternal(objectType, obisId, cosemStringValues);
}
for (CosemObjectType obisMsgType : obisWildcardCosemTypeList) {
if (obisMsgType.obisId.equalsWildCard(reducedObisId)) {
CosemObject cosemObject = getCosemObjectInternal(obisMsgType, obisId, cosemStringValues);
if (cosemObject != null) {
logger.trace("Searched reducedObisId {} in the wild card type list, result: {}", reducedObisId,
cosemObject);
obisLookupTableDynamic.put(reducedObisId, obisMsgType);
return cosemObject;
}
}
}
if (cosemObject == null) {
logger.debug("Received unknown Cosem Object(OBIS id: {})", obisId);
}
logger.debug("Received unknown Cosem Object(OBIS id: {})", obisId);
return cosemObject;
return null;
}
/**

View File

@@ -147,9 +147,9 @@ public class DSMRMeterDiscoveryService extends DSMRDiscoveryService implements P
.map(Thing::getHandler)
.filter(DSMRMeterHandler.class::isInstance)
.map(DSMRMeterHandler.class::cast)
.map(DSMRMeterHandler::getMeterDescriptor)
.map(h -> h == null ? null : h.getMeterDescriptor())
.map(d -> d == null ? null : d.getMeterType())
.filter(Objects::nonNull)
.map(h -> h.getMeterType())
.collect(Collectors.toSet());
// @formatter:on
// Create list of all configured meters that are not in the detected list. If not empty meters might not be