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

@@ -19,6 +19,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
@@ -463,8 +464,8 @@ public class DeviceStatusManagerImpl implements DeviceStatusManager {
}
sendComandsToDSS(device, intDeviceStateUpdate);
if (nextDeviceStateUpdate != null) {
if (intDeviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_CONFIG
|| intDeviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_OUTPUT) {
if (DeviceStateUpdate.UPDATE_SCENE_CONFIG.equals(intDeviceStateUpdate.getType())
|| DeviceStateUpdate.UPDATE_SCENE_OUTPUT.equals(intDeviceStateUpdate.getType())) {
updateSceneData(device, intDeviceStateUpdate);
} else {
sendComandsToDSS(device, intDeviceStateUpdate);
@@ -625,7 +626,7 @@ public class DeviceStatusManagerImpl implements DeviceStatusManager {
// to
// OFFLINE.
// An alternate algorithm is responsible for deletion.
if (newDevice.isPresent() != internalDevice.isPresent()) {
if (!Objects.equals(newDevice.isPresent(), internalDevice.isPresent())) {
internalDevice.setIsPresent(newDevice.isPresent());
}
if (newDevice.getMeterDSID() != null && !newDevice.getMeterDSID().equals(internalDevice.getMeterDSID())) {
@@ -757,9 +758,9 @@ public class DeviceStatusManagerImpl implements DeviceStatusManager {
while (!device.isDeviceUpToDate()) {
DeviceStateUpdate deviceStateUpdate = device.getNextDeviceUpdateState();
if (deviceStateUpdate != null) {
if (deviceStateUpdate.getType() != DeviceStateUpdate.OUTPUT) {
if (deviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_CONFIG
|| deviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_OUTPUT) {
if (!DeviceStateUpdate.OUTPUT.equals(deviceStateUpdate.getType())) {
if (DeviceStateUpdate.UPDATE_SCENE_CONFIG.equals(deviceStateUpdate.getType())
|| DeviceStateUpdate.UPDATE_SCENE_OUTPUT.equals(deviceStateUpdate.getType())) {
updateSceneData(device, deviceStateUpdate);
} else {
sendComandsToDSS(device, deviceStateUpdate);
@@ -767,14 +768,14 @@ public class DeviceStatusManagerImpl implements DeviceStatusManager {
} else {
DeviceStateUpdate nextDeviceStateUpdate = device.getNextDeviceUpdateState();
while (nextDeviceStateUpdate != null
&& nextDeviceStateUpdate.getType() == DeviceStateUpdate.OUTPUT) {
&& DeviceStateUpdate.OUTPUT.equals(nextDeviceStateUpdate.getType())) {
deviceStateUpdate = nextDeviceStateUpdate;
nextDeviceStateUpdate = device.getNextDeviceUpdateState();
}
sendComandsToDSS(device, deviceStateUpdate);
if (nextDeviceStateUpdate != null) {
if (deviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_CONFIG
|| deviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_OUTPUT) {
if (DeviceStateUpdate.UPDATE_SCENE_CONFIG.equals(deviceStateUpdate.getType())
|| DeviceStateUpdate.UPDATE_SCENE_OUTPUT.equals(deviceStateUpdate.getType())) {
updateSceneData(device, deviceStateUpdate);
} else {
sendComandsToDSS(device, deviceStateUpdate);