Java 17 features (H-M) (#15520)
- 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 - remove null check before instanceof Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -59,8 +59,7 @@ public class SecondGenerationConfigurationHandler {
|
||||
|
||||
sessionId = extractSessionId(getAuthenticateResponseJsonObject);
|
||||
|
||||
JsonObject authenticateJsonObject = JsonParser.parseString(getAuthenticateResponse.toString())
|
||||
.getAsJsonObject();
|
||||
JsonObject authenticateJsonObject = JsonParser.parseString(getAuthenticateResponse).getAsJsonObject();
|
||||
salt = authenticateJsonObject.get("salt").getAsString();
|
||||
|
||||
String saltedPassword = new StringBuilder(password).append(salt).toString();
|
||||
@@ -120,9 +119,7 @@ public class SecondGenerationConfigurationHandler {
|
||||
int codeStartPosition = jsonResponse.indexOf("code");
|
||||
transformStringBuilder.insert(codeStartPosition + 11, ']');
|
||||
|
||||
String transformJsonObject = transformStringBuilder.toString();
|
||||
|
||||
return transformJsonObject;
|
||||
return transformStringBuilder.toString();
|
||||
}
|
||||
|
||||
// Method extractSessionId extracts sessionId from JsonObject
|
||||
|
||||
@@ -103,10 +103,10 @@ public class SecondGenerationHandler extends BaseThingHandler {
|
||||
valueConfiguration);
|
||||
break;
|
||||
case SecondGenerationBindingConstants.CHANNEL_SMARTBATTERYCONTROLSET:
|
||||
if (command.toString().equals("ON")) {
|
||||
if ("ON".equals(command.toString())) {
|
||||
valueConfiguration = "true";
|
||||
}
|
||||
if (command.toString().equals("OFF")) {
|
||||
if ("OFF".equals(command.toString())) {
|
||||
valueConfiguration = "false";
|
||||
}
|
||||
dxsEntriesConf = "33556484";
|
||||
@@ -288,10 +288,10 @@ public class SecondGenerationHandler extends BaseThingHandler {
|
||||
String channel = cConfig.id;
|
||||
String value = channelPostsConfigurable[channelValuesCounterConfigurable];
|
||||
int dxsEntriesCheckCounter = 3;
|
||||
if (cConfig.dxsEntries.equals("33556484")) {
|
||||
if ("33556484".equals(cConfig.dxsEntries)) {
|
||||
dxsEntriesCheckCounter = 1;
|
||||
}
|
||||
if (cConfig.dxsEntries.equals("33556482")) {
|
||||
if ("33556482".equals(cConfig.dxsEntries)) {
|
||||
dxsEntriesCheckCounter = 2;
|
||||
}
|
||||
switch (dxsEntriesCheckCounter) {
|
||||
|
||||
Reference in New Issue
Block a user