[infrastructure] move infered nullness warnings to error and update EEA (#8949)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K
2020-11-12 21:07:11 +01:00
committed by GitHub
parent 0856a0b3f2
commit ba4c96d99d
155 changed files with 644 additions and 632 deletions

View File

@@ -47,8 +47,7 @@ public class GreeException extends Exception {
super(message, exception);
}
@Override
public @Nullable String getMessage() {
public String getMessageString() {
return isEmpty() ? "" : nonNullString(super.getMessage());
}
@@ -69,7 +68,7 @@ public class GreeException extends Exception {
message = MessageFormat.format("{0} ({1})", message, cause);
}
} else {
message = getMessage();
message = getMessageString();
}
return message;
}
@@ -82,7 +81,7 @@ public class GreeException extends Exception {
Class<?> extype = !isEmpty() ? getCauseClass() : null;
return (extype != null) && ((extype == SocketTimeoutException.class) || (extype == TimeoutException.class)
|| (extype == ExecutionException.class) || (extype == InterruptedException.class)
|| getMessage().toLowerCase().contains("timeout"));
|| getMessageString().toLowerCase().contains("timeout"));
}
public boolean isUnknownHost() {

View File

@@ -97,7 +97,7 @@ public class GreeDiscoveryService extends AbstractDiscoveryService {
createResult(deviceFinder.getDevices());
}
} catch (GreeException e) {
logger.info("Discovery: {}", messages.get("discovery.exception", e.getMessage()));
logger.info("Discovery: {}", messages.get("discovery.exception", e.getMessageString()));
} catch (SocketException | RuntimeException e) {
logger.warn("Discovery: {}", messages.get("discovery.exception", "RuntimeException"), e);
}

View File

@@ -122,7 +122,7 @@ public class GreeHandler extends BaseThingHandler {
message = messages.get("thinginit.failed");
logger.info("{}: {}", thingId, message);
} catch (GreeException e) {
logger.info("{}: {}", thingId, messages.get("thinginit.exception", e.getMessage()));
logger.info("{}: {}", thingId, messages.get("thinginit.exception", e.getMessageString()));
} catch (IOException e) {
logger.warn("{}: {}", thingId, messages.get("thinginit.exception", "I/O Error"), e);
} catch (RuntimeException e) {
@@ -158,7 +158,7 @@ public class GreeHandler extends BaseThingHandler {
logger.debug("{}: Command {} failed for channel {}, retry", thingId, command, channelId);
} else {
String message = logInfo(
messages.get("command.exception", command, channelId) + ": " + e.getMessage());
messages.get("command.exception", command, channelId) + ": " + e.getMessageString());
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, message);
}
} catch (IllegalArgumentException e) {
@@ -379,7 +379,7 @@ public class GreeHandler extends BaseThingHandler {
if (e.getCause() != null) {
subcode = " (" + e.getCause().getMessage() + ")";
}
String message = messages.get("update.exception", e.getMessage() + subcode);
String message = messages.get("update.exception", e.getMessageString() + subcode);
if (getThing().getStatus() == ThingStatus.OFFLINE) {
logger.debug("{}: Thing still OFFLINE ({})", thingId, message);
} else {
@@ -472,7 +472,7 @@ public class GreeHandler extends BaseThingHandler {
updateState(channelID, state);
}
} catch (GreeException e) {
logger.info("{}: {}", thingId, messages.get("channel.exception", channelID, e.getMessage()));
logger.info("{}: {}", thingId, messages.get("channel.exception", channelID, e.getMessageString()));
} catch (RuntimeException e) {
logger.warn("{}: {}", thingId, messages.get("channel.exception", "RuntimeException"), e);
}