Java 17 features (A-G) (#15516)
- add missing @override - Java style array syntax - remove redundant modifiers - always move String constants to left side in comparisons - simplify lambda expressions and return statements - use replace instead of replaceAll w/o regex - instanceof matching and multiline strings Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -263,11 +263,10 @@ public class AmbientWeatherEventListener {
|
||||
private void handleError(String event, Object... args) {
|
||||
String reason = "Unknown";
|
||||
if (args.length > 0) {
|
||||
if (args[0] instanceof String) {
|
||||
reason = (String) args[0];
|
||||
} else if (args[0] instanceof Exception) {
|
||||
reason = String.format("Exception=%s Message=%s", args[0].getClass(),
|
||||
((Exception) args[0]).getMessage());
|
||||
if (args[0] instanceof String stringArg) {
|
||||
reason = stringArg;
|
||||
} else if (args[0] instanceof Exception exception) {
|
||||
reason = String.format("Exception=%s Message=%s", args[0].getClass(), exception.getMessage());
|
||||
}
|
||||
}
|
||||
logger.debug("Listener: Received socket event: {}, Reason: {}", event, reason);
|
||||
|
||||
Reference in New Issue
Block a user