[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

@@ -92,13 +92,21 @@ public class HomekitChangeListener implements ItemRegistryChangeListener {
private void initialiseRevision() {
int revision;
try {
revision = Integer.parseInt(storage.get(REVISION_CONFIG));
String revisionString = storage.get(REVISION_CONFIG);
if (revisionString == null) {
throw new NumberFormatException();
}
revision = Integer.parseInt(revisionString);
} catch (NumberFormatException e) {
revision = 1;
storage.put(REVISION_CONFIG, "" + revision);
}
try {
lastAccessoryCount = Integer.parseInt(storage.get(ACCESSORY_COUNT));
String accessoryCountString = storage.get(ACCESSORY_COUNT);
if (accessoryCountString == null) {
throw new NumberFormatException();
}
lastAccessoryCount = Integer.parseInt(accessoryCountString);
} catch (NumberFormatException e) {
lastAccessoryCount = 0;
storage.put(ACCESSORY_COUNT, "" + accessoryRegistry.getAllAccessories().size());

View File

@@ -454,8 +454,6 @@ public class HomekitAccessoryFactory {
* @return new characteristic type
*/
private static HomekitCharacteristicType legacyCheck(HomekitCharacteristicType characteristicType) {
if (LEGACY_CHARACTERISTICS_MAPPING.containsKey(characteristicType))
return LEGACY_CHARACTERISTICS_MAPPING.get(characteristicType);
return characteristicType;
return LEGACY_CHARACTERISTICS_MAPPING.getOrDefault(characteristicType, characteristicType);
}
}