Fix/suppress PMD CompareObjectsWithEquals findings (#11476)

Newer PMD versions discover more CompareObjectsWithEquals findings.

Related to https://github.com/openhab/static-code-analysis/pull/423

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-11-02 10:43:53 +01:00
committed by GitHub
parent b67b9fcb25
commit 589400e223
82 changed files with 175 additions and 141 deletions

View File

@@ -176,7 +176,7 @@ public class OpenWebNetDeviceDiscoveryService extends AbstractDiscoveryService
}
String ownId = bridgeHandler.ownIdFromWhoWhere(deviceWho, where);
if (thingTypeUID == OpenWebNetBindingConstants.THING_TYPE_BUS_ON_OFF_SWITCH) {
if (OpenWebNetBindingConstants.THING_TYPE_BUS_ON_OFF_SWITCH.equals(thingTypeUID)) {
if (bridgeHandler.getRegisteredDevice(ownId) != null) {
logger.debug("dimmer/switch with WHERE={} already registered, skipping this discovery result", where);
return;
@@ -204,7 +204,7 @@ public class OpenWebNetDeviceDiscoveryService extends AbstractDiscoveryService
Map<String, Object> properties = new HashMap<>(2);
properties.put(OpenWebNetBindingConstants.CONFIG_PROPERTY_WHERE, whereConfig);
properties.put(OpenWebNetBindingConstants.PROPERTY_OWNID, ownId);
if (thingTypeUID == OpenWebNetBindingConstants.THING_TYPE_GENERIC_DEVICE) {
if (OpenWebNetBindingConstants.THING_TYPE_GENERIC_DEVICE.equals(thingTypeUID)) {
thingLabel = thingLabel + " (WHO=" + deviceWho + ", WHERE=" + whereConfig + ")";
} else {
thingLabel = thingLabel + " (WHERE=" + whereConfig + ")";

View File

@@ -17,6 +17,7 @@ import static org.openhab.binding.openwebnet.internal.OpenWebNetBindingConstants
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
@@ -458,13 +459,13 @@ public class OpenWebNetBridgeHandler extends ConfigStatusBridgeHandler implement
logger.info("---- CONNECTED to BUS gateway bridge '{}' ({}:{})", thing.getUID(),
((BUSGateway) gw).getHost(), ((BUSGateway) gw).getPort());
// update serial number property (with MAC address)
if (properties.get(PROPERTY_SERIAL_NO) != gw.getMACAddr().toUpperCase()) {
if (!Objects.equals(properties.get(PROPERTY_SERIAL_NO), gw.getMACAddr().toUpperCase())) {
properties.put(PROPERTY_SERIAL_NO, gw.getMACAddr().toUpperCase());
propertiesChanged = true;
logger.debug("updated property gw serialNumber: {}", properties.get(PROPERTY_SERIAL_NO));
}
}
if (properties.get(PROPERTY_FIRMWARE_VERSION) != gw.getFirmwareVersion()) {
if (!Objects.equals(properties.get(PROPERTY_FIRMWARE_VERSION), gw.getFirmwareVersion())) {
properties.put(PROPERTY_FIRMWARE_VERSION, gw.getFirmwareVersion());
propertiesChanged = true;
logger.debug("updated property gw firmware version: {}", properties.get(PROPERTY_FIRMWARE_VERSION));