[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

@@ -62,12 +62,10 @@ public class AmbientWeatherBridgeHandler extends BaseBridgeHandler {
private ScheduledFuture<?> validateKeysJob;
// Application key is granted only by request from developer
@Nullable
private String applicationKey;
private String applicationKey = "";
// API key assigned to user in ambientweather.net dashboard
@Nullable
private String apiKey;
private String apiKey = "";
// Used Ambient Weather real-time API to retrieve weather data
// for weather stations assigned to an API key
@@ -151,8 +149,9 @@ public class AmbientWeatherBridgeHandler extends BaseBridgeHandler {
return true;
}
public void setThingOfflineWithCommError(String errorDetail, String statusDescription) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, statusDescription);
public void setThingOfflineWithCommError(@Nullable String errorDetail, @Nullable String statusDescription) {
String status = statusDescription != null ? statusDescription : "null";
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, status);
}
@Override
@@ -213,11 +212,11 @@ public class AmbientWeatherBridgeHandler extends BaseBridgeHandler {
updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE);
}
public @Nullable String getApplicationKey() {
public String getApplicationKey() {
return applicationKey;
}
public @Nullable String getApiKey() {
public String getApiKey() {
return apiKey;
}

View File

@@ -132,6 +132,6 @@ public class RemoteSensor {
*/
private String convertSoilMoistureToString(double soilMoisture) {
Double key = soilMoistureMap.ceilingKey(soilMoisture);
return key == null ? "UNKNOWN" : soilMoistureMap.get(key);
return key == null ? "UNKNOWN" : soilMoistureMap.getOrDefault(key, "UNKNOWN");
}
}