[infrastructure] add external null-annotations (#8848)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user