[dscalarm] Fix checkstyle and warning (#15424)

Signed-off-by: lsiepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2023-08-14 22:08:22 +02:00 committed by GitHub
parent c465344c01
commit c47e833ed9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 25 deletions

View File

@ -219,13 +219,13 @@ public class DSCAlarmMessage {
case PartitionArmed: /* 652 */
mode = message.substring(4);
if (mode.equals("0")) {
if ("0".equals(mode)) {
name += " (Away)";
} else if (mode.equals("1")) {
} else if ("1".equals(mode)) {
name += " (Stay)";
} else if (mode.equals("2")) {
} else if ("2".equals(mode)) {
name += " (ZEA)";
} else if (mode.equals("3")) {
} else if ("3".equals(mode)) {
name += " (ZES)";
}
messageType = DSCAlarmMessageType.PARTITION_EVENT;
@ -343,37 +343,37 @@ public class DSCAlarmMessage {
sb.append(description);
sb.append("\"");
if (!timeStamp.equals("")) {
if (!"".equals(timeStamp)) {
sb.append(", Time Stamp: ");
sb.append(timeStamp);
}
if (!partition.equals("0")) {
if (!"0".equals(partition)) {
sb.append(", Partition: ");
sb.append(partition);
}
if (!zone.equals("0")) {
if (!"0".equals(zone)) {
sb.append(", Zone: ");
sb.append(zone);
}
if (!data.equals("")) {
if (!"".equals(data)) {
sb.append(", Data: ");
sb.append(data);
}
if (!mode.equals("")) {
if (!"".equals(mode)) {
sb.append(", Mode: ");
sb.append(mode);
}
if (!user.equals("")) {
if (!"".equals(user)) {
sb.append(", user: ");
sb.append(user);
}
if (!error.equals("")) {
if (!"".equals(error)) {
sb.append(", error: ");
sb.append(error);
}

View File

@ -306,7 +306,9 @@ public class DSCAlarmHandlerFactory extends BaseThingHandlerFactory {
if (discoveryServiceRegistration != null) {
DSCAlarmDiscoveryService discoveryService = (DSCAlarmDiscoveryService) bundleContext
.getService(discoveryServiceRegistration.getReference());
discoveryService.deactivate();
if (discoveryService != null) {
discoveryService.deactivate();
}
discoveryServiceRegistration.unregister();
discoveryServiceRegistration = null;
discoveryServiceRegistrations.remove(thingHandler.getThing().getUID());

View File

@ -477,16 +477,16 @@ public abstract class DSCAlarmBaseBridgeHandler extends BaseBridgeHandler {
if (dscAlarmCode == DSCAlarmCode.LoginResponse) {
String dscAlarmMessageData = dscAlarmMessage.getMessageInfo(DSCAlarmMessageInfoType.DATA);
if (dscAlarmMessageData.equals("3")) {
if ("3".equals(dscAlarmMessageData)) {
sendCommand(DSCAlarmCode.NetworkLogin);
// onConnected();
} else if (dscAlarmMessageData.equals("1")) {
} else if ("1".equals(dscAlarmMessageData)) {
onConnected();
}
return;
} else if (dscAlarmCode == DSCAlarmCode.CommandAcknowledge) {
String dscAlarmMessageData = dscAlarmMessage.getMessageInfo(DSCAlarmMessageInfoType.DATA);
if (dscAlarmMessageData.equals("000")) {
if ("000".equals(dscAlarmMessageData)) {
setBridgeStatus(true);
}
}
@ -764,7 +764,7 @@ public abstract class DSCAlarmBaseBridgeHandler extends BaseBridgeHandler {
"sendCommand(): \'keystroke\' must be a single character string from 0 to 9, *, #, F, A, P, a to e, <, >, =, or ^, it was: {}",
dscAlarmData[0]);
break;
} else if (dscAlarmData[0].equals("L")) { /* Long Key Press */
} else if ("L".equals(dscAlarmData[0])) { /* Long Key Press */
try {
Thread.sleep(1500);
data = "^";

View File

@ -106,7 +106,7 @@ public abstract class DSCAlarmBaseThingHandler extends BaseThingHandler {
logger.debug("initializeThingHandler(): Initialize Thing Handler - {}", thing.getUID());
for (Channel channel : channels) {
if (channel.getAcceptedItemType().equals("DateTime")) {
if ("DateTime".equals(channel.getAcceptedItemType())) {
updateChannel(channel.getUID(), 0, "0000010100");
} else {
updateChannel(channel.getUID(), 0, "");
@ -150,8 +150,8 @@ public abstract class DSCAlarmBaseThingHandler extends BaseThingHandler {
ThingHandler handler = bridge.getHandler();
if (handler instanceof DSCAlarmBaseBridgeHandler) {
this.dscAlarmBridgeHandler = (DSCAlarmBaseBridgeHandler) handler;
if (handler instanceof DSCAlarmBaseBridgeHandler dscAlarmBridgeHandler) {
this.dscAlarmBridgeHandler = dscAlarmBridgeHandler;
} else {
logger.debug("getDSCAlarmBridgeHandler(): Unable to get bridge handler!");
}

View File

@ -106,22 +106,22 @@ public class PartitionThingHandler extends DSCAlarmBaseThingHandler {
switch (channelUID.getId()) {
case PARTITION_ARM_MODE:
int partitionNumber = getPartitionNumber();
if (command.toString().equals("0")) {
if ("0".equals(command.toString())) {
dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.PartitionDisarmControl,
String.valueOf(partitionNumber));
} else if (command.toString().equals("1")) {
} else if ("1".equals(command.toString())) {
dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.PartitionArmControlAway,
String.valueOf(partitionNumber));
} else if (command.toString().equals("2")) {
} else if ("2".equals(command.toString())) {
dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.PartitionArmControlStay,
String.valueOf(partitionNumber));
} else if (command.toString().equals("3")) {
} else if ("3".equals(command.toString())) {
dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.PartitionArmControlZeroEntryDelay,
String.valueOf(partitionNumber));
} else if (command.toString().equals("4")) {
} else if ("4".equals(command.toString())) {
dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.PartitionArmControlZeroEntryDelay,
String.valueOf(partitionNumber));
} else if (command.toString().equals("5")) {
} else if ("5".equals(command.toString())) {
dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.PartitionArmControlWithUserCode,
String.valueOf(partitionNumber));
}