diff --git a/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/discovery/internal/BluetoothDeviceSnapshot.java b/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/discovery/internal/BluetoothDeviceSnapshot.java index 9f477e61690..f192d7c41fb 100644 --- a/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/discovery/internal/BluetoothDeviceSnapshot.java +++ b/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/discovery/internal/BluetoothDeviceSnapshot.java @@ -165,6 +165,7 @@ public class BluetoothDeviceSnapshot extends BluetoothDiscoveryDevice { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/services/AbstractStatelessBoschSHCService.java b/bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/services/AbstractStatelessBoschSHCService.java index c205d366d5d..0230d71d5b3 100644 --- a/bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/services/AbstractStatelessBoschSHCService.java +++ b/bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/services/AbstractStatelessBoschSHCService.java @@ -57,8 +57,9 @@ public abstract class AbstractStatelessBoschSHCService extends AbstractBoschSHCS */ public void postAction() throws InterruptedException, TimeoutException, ExecutionException { BridgeHandler bridgeHandler = getBridgeHandler(); - if (bridgeHandler == null) + if (bridgeHandler == null) { return; + } bridgeHandler.postAction(endpoint); } diff --git a/bundles/org.openhab.binding.cm11a/src/main/java/org/openhab/binding/cm11a/internal/X10ReceivedData.java b/bundles/org.openhab.binding.cm11a/src/main/java/org/openhab/binding/cm11a/internal/X10ReceivedData.java index a5dd75cc239..40fcf4fc7cc 100644 --- a/bundles/org.openhab.binding.cm11a/src/main/java/org/openhab/binding/cm11a/internal/X10ReceivedData.java +++ b/bundles/org.openhab.binding.cm11a/src/main/java/org/openhab/binding/cm11a/internal/X10ReceivedData.java @@ -127,6 +127,7 @@ public class X10ReceivedData { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java index 4c3fb70878a..70a9bf57473 100644 --- a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java +++ b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java @@ -392,7 +392,7 @@ public class LightThingHandler extends DeconzBaseThingHandler { } break; case CHANNEL_COLOR: - if (on != null && on == false) { + if (on != null && !on) { updateState(channelId, OnOffType.OFF); } else if (bri != null && "xy".equals(newState.colormode)) { final double @Nullable [] xy = newState.xy; diff --git a/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/communication/DigiplexResponseResolver.java b/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/communication/DigiplexResponseResolver.java index 14a063d481e..384d00d2417 100644 --- a/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/communication/DigiplexResponseResolver.java +++ b/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/communication/DigiplexResponseResolver.java @@ -113,11 +113,7 @@ public class DigiplexResponseResolver { } private static boolean toBoolean(char value) { - if (value == 'O') { - return false; - } else { - return true; - } + return value != 'O'; } private static DigiplexResponse resolveSystemEvent(String message) { diff --git a/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/communication/events/AbstractEvent.java b/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/communication/events/AbstractEvent.java index ebc7e86c7f3..559257bac8d 100644 --- a/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/communication/events/AbstractEvent.java +++ b/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/communication/events/AbstractEvent.java @@ -41,9 +41,6 @@ public abstract class AbstractEvent implements DigiplexResponse { // TODO: According to documentation: areaNo = 255 - Occurs in at least one area enabled in the system. // I did never encounter 255 on my system though (EVO192). // 15 is returned instead, which (I believe) has the same meaning. - if (this.areaNo == 15 || this.areaNo == 255) { - return true; - } - return false; + return (this.areaNo == 15 || this.areaNo == 255); } } diff --git a/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/discovery/DigiplexDiscoveryService.java b/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/discovery/DigiplexDiscoveryService.java index b6348a759d8..f28e6d3e51b 100644 --- a/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/discovery/DigiplexDiscoveryService.java +++ b/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/discovery/DigiplexDiscoveryService.java @@ -101,11 +101,7 @@ public class DigiplexDiscoveryService extends AbstractDiscoveryService private boolean isDefaultName(ZoneLabelResponse response) { return ZONE_DEFAULT_NAMES.stream().anyMatch(format -> { - if (String.format(format, response.zoneNo).equals(response.zoneName)) { - return true; - } else { - return false; - } + return String.format(format, response.zoneNo).equals(response.zoneName); }); } diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/datatypes/AssignSensorType.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/datatypes/AssignSensorType.java index 1813e53fbe1..e85c90e3b4c 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/datatypes/AssignSensorType.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/datatypes/AssignSensorType.java @@ -83,6 +83,7 @@ public class AssignSensorType { * * @see java.lang.Object#equals(java.lang.Object) */ + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/impl/DeviceSensorValue.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/impl/DeviceSensorValue.java index 0eb75df6fed..af2464dc130 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/impl/DeviceSensorValue.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/impl/DeviceSensorValue.java @@ -267,6 +267,7 @@ public class DeviceSensorValue { * * @see java.lang.Object#equals(java.lang.Object) */ + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/Util.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/Util.java index 41a4b6e4d5e..674e1e24c8d 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/Util.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/Util.java @@ -33,13 +33,7 @@ public class Util { * @return true or false */ public static boolean inRange(int value, int min, int max) { - if (value < min) { - return false; - } - if (value > max) { - return false; - } - return true; + return value >= min && value <= max; } /** diff --git a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/PanelThingHandler.java b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/PanelThingHandler.java index 82e7f9225d7..c719f9afa2a 100644 --- a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/PanelThingHandler.java +++ b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/PanelThingHandler.java @@ -380,7 +380,6 @@ public class PanelThingHandler extends DSCAlarmBaseThingHandler { String[] channelTypes = { PANEL_SERVICE_REQUIRED, PANEL_AC_TROUBLE, PANEL_TELEPHONE_TROUBLE, PANEL_FTC_TROUBLE, PANEL_ZONE_FAULT, PANEL_ZONE_TAMPER, PANEL_ZONE_LOW_BATTERY, PANEL_TIME_LOSS }; - String channel; ChannelUID channelUID = null; int bitCount = 8; diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_11/A5_11_03.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_11/A5_11_03.java index 49b8b31dfc9..7ae30eeea5c 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_11/A5_11_03.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_11/A5_11_03.java @@ -40,12 +40,8 @@ public class A5_11_03 extends _4BSMessage { int state = (db1 >> 4) & 0x03; - if (state != 0) { - // TODO: display error state on thing - return true; - } else { - return false; - } + // TODO: display error state on thing + return state != 0; } protected State getPositionData() { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP3PacketFactory.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP3PacketFactory.java index c444bcac541..4fbf31a64ef 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP3PacketFactory.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP3PacketFactory.java @@ -49,7 +49,7 @@ public class ESP3PacketFactory { new byte[] { SAMessageType.SA_WR_LEARNMODE.getValue(), (byte) (activate ? 1 : 0), 0, 0, 0, 0, 0 }); } - public final static BasePacket SA_RD_LEARNEDCLIENTS = new SAMessage(SAMessageType.SA_RD_LEARNEDCLIENTS); + public static final BasePacket SA_RD_LEARNEDCLIENTS = new SAMessage(SAMessageType.SA_RD_LEARNEDCLIENTS); public static BasePacket SA_RD_MAILBOX_STATUS(byte[] clientId, byte[] controllerId) { return new SAMessage(SAMessageType.SA_RD_MAILBOX_STATUS, diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/connection/EnturNoConnection.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/connection/EnturNoConnection.java index ee8896f1303..8d9b01fe5e4 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/connection/EnturNoConnection.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/connection/EnturNoConnection.java @@ -196,7 +196,7 @@ public class EnturNoConnection { .collect(groupingBy(call -> call.quay.id)); List processedData = new ArrayList<>(); - if (departures.keySet().size() > 0) { + if (!departures.keySet().isEmpty()) { DisplayData processedData01 = getDisplayData(stopPlace, departures, 0); processedData.add(processedData01); } diff --git a/bundles/org.openhab.binding.fineoffsetweatherstation/src/main/java/org/openhab/binding/fineoffsetweatherstation/internal/domain/Measurand.java b/bundles/org.openhab.binding.fineoffsetweatherstation/src/main/java/org/openhab/binding/fineoffsetweatherstation/internal/domain/Measurand.java index 6332ee82c8e..786cc992ac9 100644 --- a/bundles/org.openhab.binding.fineoffsetweatherstation/src/main/java/org/openhab/binding/fineoffsetweatherstation/internal/domain/Measurand.java +++ b/bundles/org.openhab.binding.fineoffsetweatherstation/src/main/java/org/openhab/binding/fineoffsetweatherstation/internal/domain/Measurand.java @@ -348,8 +348,9 @@ public enum Measurand { } public MeasureType getMeasureType(@Nullable ParserCustomizationType customizationType) { - if (customizationType == null) + if (customizationType == null) { return measureType; + } return Optional.ofNullable(customizations).map(m -> m.get(customizationType)) .map(ParserCustomization::getMeasureType).orElse(measureType); } diff --git a/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/FroniusHttpUtil.java b/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/FroniusHttpUtil.java index 4f993c8654a..5977390948a 100644 --- a/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/FroniusHttpUtil.java +++ b/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/FroniusHttpUtil.java @@ -38,7 +38,7 @@ public class FroniusHttpUtil { * @return the response body * @throws FroniusCommunicationException when the request execution failed or interrupted */ - public synchronized static String executeUrl(String url, int timeout) throws FroniusCommunicationException { + public static synchronized String executeUrl(String url, int timeout) throws FroniusCommunicationException { int attemptCount = 1; try { while (true) { diff --git a/bundles/org.openhab.binding.fsinternetradio/src/test/java/org/openhab/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java b/bundles/org.openhab.binding.fsinternetradio/src/test/java/org/openhab/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java index 60a9c44c58f..7b4b9a1cda7 100644 --- a/bundles/org.openhab.binding.fsinternetradio/src/test/java/org/openhab/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java +++ b/bundles/org.openhab.binding.fsinternetradio/src/test/java/org/openhab/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java @@ -821,10 +821,7 @@ public class FSInternetRadioHandlerJavaTest extends JavaTest { BigDecimal port = (BigDecimal) config.get(FSInternetRadioBindingConstants.CONFIG_PROPERTY_PORT.toString()); String pin = (String) config.get(FSInternetRadioBindingConstants.CONFIG_PROPERTY_PIN.toString()); - if (ip == null || port.compareTo(BigDecimal.ZERO) == 0 || pin == null || pin.isEmpty()) { - return false; - } - return true; + return !(ip == null || port.compareTo(BigDecimal.ZERO) == 0 || pin == null || pin.isEmpty()); } @SuppressWarnings("null") diff --git a/bundles/org.openhab.binding.gardena/src/main/java/org/openhab/binding/gardena/internal/model/dto/Device.java b/bundles/org.openhab.binding.gardena/src/main/java/org/openhab/binding/gardena/internal/model/dto/Device.java index 63f5033f8d2..29839ae4428 100644 --- a/bundles/org.openhab.binding.gardena/src/main/java/org/openhab/binding/gardena/internal/model/dto/Device.java +++ b/bundles/org.openhab.binding.gardena/src/main/java/org/openhab/binding/gardena/internal/model/dto/Device.java @@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory; public class Device { private final Logger logger = LoggerFactory.getLogger(Device.class); - private transient static final String DEVICE_TYPE_PREFIX = "gardena smart"; + private static final transient String DEVICE_TYPE_PREFIX = "gardena smart"; public boolean active = true; public String id; public String deviceType; diff --git a/bundles/org.openhab.binding.globalcache/src/main/java/org/openhab/binding/globalcache/internal/handler/GlobalCacheHandler.java b/bundles/org.openhab.binding.globalcache/src/main/java/org/openhab/binding/globalcache/internal/handler/GlobalCacheHandler.java index c95577db53a..9456d28227f 100644 --- a/bundles/org.openhab.binding.globalcache/src/main/java/org/openhab/binding/globalcache/internal/handler/GlobalCacheHandler.java +++ b/bundles/org.openhab.binding.globalcache/src/main/java/org/openhab/binding/globalcache/internal/handler/GlobalCacheHandler.java @@ -443,10 +443,10 @@ public class GlobalCacheHandler extends BaseThingHandler { private Logger logger = LoggerFactory.getLogger(CommandProcessor.class); private boolean terminate = false; - private final String TERMINATE_COMMAND = "terminate"; + private static final String TERMINATE_COMMAND = "terminate"; - private final int SEND_QUEUE_MAX_DEPTH = 10; - private final int SEND_QUEUE_TIMEOUT = 2000; + private static final int SEND_QUEUE_MAX_DEPTH = 10; + private static final int SEND_QUEUE_TIMEOUT = 2000; private ConnectionManager connectionManager; @@ -594,19 +594,19 @@ public class GlobalCacheHandler extends BaseThingHandler { private boolean deviceIsConnected; - private final String COMMAND_NAME = "command"; - private final String SERIAL1_NAME = "serial-1"; - private final String SERIAL2_NAME = "serial-2"; + private static final String COMMAND_NAME = "command"; + private static final String SERIAL1_NAME = "serial-1"; + private static final String SERIAL2_NAME = "serial-2"; - private final int COMMAND_PORT = 4998; - private final int SERIAL1_PORT = 4999; - private final int SERIAL2_PORT = 5000; + private static final int COMMAND_PORT = 4998; + private static final int SERIAL1_PORT = 4999; + private static final int SERIAL2_PORT = 5000; - private final int SOCKET_CONNECT_TIMEOUT = 1500; + private static final int SOCKET_CONNECT_TIMEOUT = 1500; private ScheduledFuture connectionMonitorJob; - private final int CONNECTION_MONITOR_FREQUENCY = 60; - private final int CONNECTION_MONITOR_START_DELAY = 15; + private static final int CONNECTION_MONITOR_FREQUENCY = 60; + private static final int CONNECTION_MONITOR_START_DELAY = 15; private Runnable connectionMonitorRunnable = () -> { logger.trace("Performing connection check for thing {} at IP {}", thingID(), commandConnection.getIP()); @@ -844,10 +844,7 @@ public class GlobalCacheHandler extends BaseThingHandler { } private boolean deviceSupportsSerialPort2() { - if (thing.getThingTypeUID().equals(THING_TYPE_GC_100_12)) { - return true; - } - return false; + return thing.getThingTypeUID().equals(THING_TYPE_GC_100_12); } /* diff --git a/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/handler/GoEChargerV2Handler.java b/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/handler/GoEChargerV2Handler.java index 5f648ee4f1b..a853a8a14ba 100644 --- a/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/handler/GoEChargerV2Handler.java +++ b/bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/handler/GoEChargerV2Handler.java @@ -68,6 +68,7 @@ public class GoEChargerV2Handler extends GoEChargerBaseHandler { super(thing, httpClient); } + @SuppressWarnings("PMD.SimplifyBooleanExpressions") @Override protected State getValue(String channelId, GoEStatusResponseBaseDTO goeResponseBase) { var state = super.getValue(channelId, goeResponseBase); diff --git a/bundles/org.openhab.binding.gpio/src/main/java/org/openhab/binding/gpio/internal/handler/PigpioDigitalInputHandler.java b/bundles/org.openhab.binding.gpio/src/main/java/org/openhab/binding/gpio/internal/handler/PigpioDigitalInputHandler.java index 538dee85c10..65086458a00 100644 --- a/bundles/org.openhab.binding.gpio/src/main/java/org/openhab/binding/gpio/internal/handler/PigpioDigitalInputHandler.java +++ b/bundles/org.openhab.binding.gpio/src/main/java/org/openhab/binding/gpio/internal/handler/PigpioDigitalInputHandler.java @@ -66,8 +66,9 @@ public class PigpioDigitalInputHandler implements ChannelHandler { } else if (pullupdownStr.equals(GPIOBindingConstants.PUD_UP)) { pullupdown = JPigpio.PI_PUD_UP; } else { - if (!pullupdownStr.equals(GPIOBindingConstants.PUD_OFF)) + if (!pullupdownStr.equals(GPIOBindingConstants.PUD_OFF)) { throw new InvalidPullUpDownException(); + } } gpio = new GPIO(jPigpio, gpioId, JPigpio.PI_INPUT); jPigpio.gpioSetAlertFunc(gpio.getPin(), (gpio, level, tick) -> { diff --git a/bundles/org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeException.java b/bundles/org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeException.java index aad379c0c2e..6706e1e7cb9 100644 --- a/bundles/org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeException.java +++ b/bundles/org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeException.java @@ -33,7 +33,7 @@ import com.google.gson.JsonSyntaxException; @NonNullByDefault public class GreeException extends Exception { private static final long serialVersionUID = -2337258558995287405L; - private static String EX_NONE = "none"; + private static final String EX_NONE = "none"; public GreeException(@Nullable Exception exception) { super(exception); diff --git a/bundles/org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/handler/GreeAirDevice.java b/bundles/org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/handler/GreeAirDevice.java index a55b8ec30a0..f6c2eecc2f5 100644 --- a/bundles/org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/handler/GreeAirDevice.java +++ b/bundles/org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/handler/GreeAirDevice.java @@ -60,7 +60,7 @@ import com.google.gson.JsonSyntaxException; @NonNullByDefault public class GreeAirDevice { private final Logger logger = LoggerFactory.getLogger(GreeAirDevice.class); - private final static Gson gson = new Gson(); + private static final Gson gson = new Gson(); private boolean isBound = false; private final InetAddress ipAddress; private int port = 0; @@ -80,7 +80,6 @@ public class GreeAirDevice { } public void getDeviceStatus(DatagramSocket clientSocket) throws GreeException { - if (!isBound) { throw new GreeException("Device not bound"); } diff --git a/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java b/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java index 3d02d008ef4..8cd28158675 100644 --- a/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java +++ b/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java @@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory; @NonNullByDefault public class HeosActions implements ThingActions { - private final static Logger logger = LoggerFactory.getLogger(HeosActions.class); + private static final Logger logger = LoggerFactory.getLogger(HeosActions.class); private @Nullable HeosBridgeHandler handler; diff --git a/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/handler/HeosChannelHandlerGrouping.java b/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/handler/HeosChannelHandlerGrouping.java index 75f09f7c75c..e37801f8f32 100644 --- a/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/handler/HeosChannelHandlerGrouping.java +++ b/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/handler/HeosChannelHandlerGrouping.java @@ -43,7 +43,6 @@ public class HeosChannelHandlerGrouping extends BaseHeosChannelHandler { @Override public void handleGroupCommand(Command command, @Nullable String id, ThingUID uid, HeosGroupHandler heosGroupHandler) throws IOException, ReadException { - if (command instanceof RefreshType) { return; } diff --git a/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/handler/HeosThingBaseHandler.java b/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/handler/HeosThingBaseHandler.java index addba554e4f..8dea3c4a919 100644 --- a/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/handler/HeosThingBaseHandler.java +++ b/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/handler/HeosThingBaseHandler.java @@ -278,7 +278,6 @@ public abstract class HeosThingBaseHandler extends BaseThingHandler implements H } switch (command) { - case PLAYER_STATE_CHANGED: playerStateChanged(eventObject); break; diff --git a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/client/RpcClient.java b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/client/RpcClient.java index 75f073e20f7..3c171b80452 100644 --- a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/client/RpcClient.java +++ b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/client/RpcClient.java @@ -131,8 +131,9 @@ public abstract class RpcClient { * Disposes the client. */ public void dispose() { - if (future != null) + if (future != null) { future.cancel(true); + } } /** diff --git a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/HomematicTypeGeneratorImpl.java b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/HomematicTypeGeneratorImpl.java index 9be4870efcc..a572a4f5029 100644 --- a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/HomematicTypeGeneratorImpl.java +++ b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/HomematicTypeGeneratorImpl.java @@ -335,7 +335,7 @@ public class HomematicTypeGeneratorImpl implements HomematicTypeGenerator { ParameterOption defaultOption = options.get(offset); logger.trace("Changing default option to {} (offset {})", defaultOption, offset); builder.withDefault(defaultOption.getValue()); - } else if (options.size() > 0) { + } else if (!options.isEmpty()) { ParameterOption defaultOption = options.get(0); logger.trace("Changing default option to {} (first value)", defaultOption); builder.withDefault(defaultOption.getValue()); diff --git a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/device/InsteonAddress.java b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/device/InsteonAddress.java index bcbb3a64b9c..8808869f116 100644 --- a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/device/InsteonAddress.java +++ b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/device/InsteonAddress.java @@ -148,6 +148,7 @@ public class InsteonAddress { return s; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.km200/src/main/java/org/openhab/binding/km200/internal/handler/KM200SwitchProgramServiceHandler.java b/bundles/org.openhab.binding.km200/src/main/java/org/openhab/binding/km200/internal/handler/KM200SwitchProgramServiceHandler.java index 441cc3c55b6..a72c6c3b128 100644 --- a/bundles/org.openhab.binding.km200/src/main/java/org/openhab/binding/km200/internal/handler/KM200SwitchProgramServiceHandler.java +++ b/bundles/org.openhab.binding.km200/src/main/java/org/openhab/binding/km200/internal/handler/KM200SwitchProgramServiceHandler.java @@ -49,13 +49,13 @@ public class KM200SwitchProgramServiceHandler { protected final Integer MIN_TIME = 0; protected final Integer MAX_TIME = 1430; - protected final static String TYPE_MONDAY = "Mo"; - protected final static String TYPE_TUESDAY = "Tu"; - protected final static String TYPE_WEDNESDAY = "We"; - protected final static String TYPE_THURSDAY = "Th"; - protected final static String TYPE_FRIDAY = "Fr"; - protected final static String TYPE_SATURDAY = "Sa"; - protected final static String TYPE_SUNDAY = "Su"; + protected static final String TYPE_MONDAY = "Mo"; + protected static final String TYPE_TUESDAY = "Tu"; + protected static final String TYPE_WEDNESDAY = "We"; + protected static final String TYPE_THURSDAY = "Th"; + protected static final String TYPE_FRIDAY = "Fr"; + protected static final String TYPE_SATURDAY = "Sa"; + protected static final String TYPE_SUNDAY = "Su"; private String activeDay = TYPE_MONDAY; private Integer activeCycle = 1; diff --git a/bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/common/Variable.java b/bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/common/Variable.java index a5e4894615a..3b929c61553 100644 --- a/bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/common/Variable.java +++ b/bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/common/Variable.java @@ -244,6 +244,7 @@ public enum Variable { * @param is2013 the target module's-generation * @return true if a poll is required to get the new status-value */ + @SuppressWarnings("PMD.SimplifyBooleanReturns") public boolean shouldPollStatusAfterCommand(int firmwareVersion) { // Regulator set-points will send status-messages on every change (all firmware versions) if (type == Type.REGULATOR) { diff --git a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/util/PercentageConverter.java b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/util/PercentageConverter.java index 8e8a3821029..3c312164264 100644 --- a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/util/PercentageConverter.java +++ b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/util/PercentageConverter.java @@ -30,8 +30,9 @@ public class PercentageConverter { * @return if hexRepresentation == null return -1, otherwise return percentage */ public static int getPercentage(@Nullable String hexRepresentation) { - if (hexRepresentation == null) + if (hexRepresentation == null) { return -1; + } int decimal = Integer.parseInt(hexRepresentation, 16); BigDecimal level = new BigDecimal(100 * decimal).divide(new BigDecimal(255), RoundingMode.FLOOR); return level.intValue(); diff --git a/bundles/org.openhab.binding.luxtronikheatpump/src/main/java/org/openhab/binding/luxtronikheatpump/internal/enums/HeatpumpChannel.java b/bundles/org.openhab.binding.luxtronikheatpump/src/main/java/org/openhab/binding/luxtronikheatpump/internal/enums/HeatpumpChannel.java index 59e02d57dcf..f52e7a1d08d 100644 --- a/bundles/org.openhab.binding.luxtronikheatpump/src/main/java/org/openhab/binding/luxtronikheatpump/internal/enums/HeatpumpChannel.java +++ b/bundles/org.openhab.binding.luxtronikheatpump/src/main/java/org/openhab/binding/luxtronikheatpump/internal/enums/HeatpumpChannel.java @@ -1410,11 +1410,7 @@ public enum HeatpumpChannel { int code = visiblity.getCode(); - if (visibilityValues.length < code || visibilityValues[code] == 1) { - return true; - } - - return false; + return (visibilityValues.length < code || visibilityValues[code] == 1); } public static HeatpumpChannel fromString(String heatpumpCommand) throws InvalidChannelException { diff --git a/bundles/org.openhab.binding.magentatv/src/main/java/org/openhab/binding/magentatv/internal/handler/MagentaTVControl.java b/bundles/org.openhab.binding.magentatv/src/main/java/org/openhab/binding/magentatv/internal/handler/MagentaTVControl.java index 7c076b985fc..0fce1cb9771 100644 --- a/bundles/org.openhab.binding.magentatv/src/main/java/org/openhab/binding/magentatv/internal/handler/MagentaTVControl.java +++ b/bundles/org.openhab.binding.magentatv/src/main/java/org/openhab/binding/magentatv/internal/handler/MagentaTVControl.java @@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory; @NonNullByDefault public class MagentaTVControl { private final Logger logger = LoggerFactory.getLogger(MagentaTVControl.class); - private final static HashMap KEY_MAP = new HashMap<>(); + private static final HashMap KEY_MAP = new HashMap<>(); private final MagentaTVNetwork network; private final MagentaTVHttp http = new MagentaTVHttp(); diff --git a/bundles/org.openhab.binding.miele/src/main/java/org/openhab/binding/miele/internal/TimeStabilizer.java b/bundles/org.openhab.binding.miele/src/main/java/org/openhab/binding/miele/internal/TimeStabilizer.java index 090245a6bf2..81fcb188b70 100644 --- a/bundles/org.openhab.binding.miele/src/main/java/org/openhab/binding/miele/internal/TimeStabilizer.java +++ b/bundles/org.openhab.binding.miele/src/main/java/org/openhab/binding/miele/internal/TimeStabilizer.java @@ -30,8 +30,8 @@ import org.eclipse.jdt.annotation.Nullable; @NonNullByDefault public class TimeStabilizer { - private final static int SLIDING_SECONDS = 300; - private final static int MAX_FLUCTUATION_SECONDS = 180; + private static final int SLIDING_SECONDS = 300; + private static final int MAX_FLUCTUATION_SECONDS = 180; private final Deque cache = new ConcurrentLinkedDeque(); diff --git a/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/webservice/api/TransitionState.java b/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/webservice/api/TransitionState.java index 8b54bb9d3aa..85390582951 100644 --- a/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/webservice/api/TransitionState.java +++ b/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/webservice/api/TransitionState.java @@ -55,6 +55,7 @@ public class TransitionState { return previousState.map(this::hasFinishedChangedFromPreviousState).orElse(true); } + @SuppressWarnings("PMD.SimplifyBooleanReturns") private boolean hasFinishedChangedFromPreviousState(DeviceState previous) { if (previous.getStateType().equals(nextState.getStateType())) { return false; diff --git a/bundles/org.openhab.binding.millheat/src/main/java/org/openhab/binding/millheat/internal/handler/MillheatAccountHandler.java b/bundles/org.openhab.binding.millheat/src/main/java/org/openhab/binding/millheat/internal/handler/MillheatAccountHandler.java index b42f92851db..2de266a627f 100644 --- a/bundles/org.openhab.binding.millheat/src/main/java/org/openhab/binding/millheat/internal/handler/MillheatAccountHandler.java +++ b/bundles/org.openhab.binding.millheat/src/main/java/org/openhab/binding/millheat/internal/handler/MillheatAccountHandler.java @@ -128,10 +128,7 @@ public class MillheatAccountHandler extends BaseBridgeHandler { private boolean allowModelUpdate() { final long timeSinceLastUpdate = System.currentTimeMillis() - model.getLastUpdated(); - if (timeSinceLastUpdate > MIN_TIME_BETWEEEN_MODEL_UPDATES_MS) { - return true; - } - return false; + return timeSinceLastUpdate > MIN_TIME_BETWEEEN_MODEL_UPDATES_MS; } public MillheatModel getModel() { diff --git a/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/parser/CommonModelParser.java b/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/parser/CommonModelParser.java index 69cd751526e..52204c9df0e 100644 --- a/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/parser/CommonModelParser.java +++ b/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/parser/CommonModelParser.java @@ -12,7 +12,7 @@ */ package org.openhab.binding.modbus.sunspec.internal.parser; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.binding.modbus.sunspec.internal.SunSpecConstants; @@ -52,10 +52,10 @@ public class CommonModelParser extends AbstractBaseParser implements SunspecPars } // parse manufacturer, model and version - block.manufacturer = ModbusBitUtilities.extractStringFromRegisters(raw, 2, 32, Charset.forName("UTF-8")); - block.model = ModbusBitUtilities.extractStringFromRegisters(raw, 18, 32, Charset.forName("UTF-8")); - block.version = ModbusBitUtilities.extractStringFromRegisters(raw, 42, 16, Charset.forName("UTF-8")); - block.serialNumber = ModbusBitUtilities.extractStringFromRegisters(raw, 50, 32, Charset.forName("UTF-8")); + block.manufacturer = ModbusBitUtilities.extractStringFromRegisters(raw, 2, 32, StandardCharsets.UTF_8); + block.model = ModbusBitUtilities.extractStringFromRegisters(raw, 18, 32, StandardCharsets.UTF_8); + block.version = ModbusBitUtilities.extractStringFromRegisters(raw, 42, 16, StandardCharsets.UTF_8); + block.serialNumber = ModbusBitUtilities.extractStringFromRegisters(raw, 50, 32, StandardCharsets.UTF_8); block.deviceAddress = extractUInt16(raw, 66, 1); diff --git a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/handler/NanoleafControllerHandler.java b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/handler/NanoleafControllerHandler.java index 3f4cbf464d1..49953a787f6 100644 --- a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/handler/NanoleafControllerHandler.java +++ b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/handler/NanoleafControllerHandler.java @@ -903,8 +903,6 @@ public class NanoleafControllerHandler extends BaseBridgeHandler implements Nano break; case CHANNEL_COLOR_TEMPERATURE_ABS: // Color temperature (absolute) - int colorTempKelvin; - IntegerState state = new Ct(); if (command instanceof DecimalType) { state.setValue(((DecimalType) command).intValue()); diff --git a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/model/PanelLayout.java b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/model/PanelLayout.java index 125773de078..aa3fa00d427 100644 --- a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/model/PanelLayout.java +++ b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/model/PanelLayout.java @@ -78,7 +78,7 @@ public class PanelLayout { goEquals = go.equals(otherGo); } - if (goEquals == false) { + if (!goEquals) { // No reason to compare layout if global oriantation is different return false; } diff --git a/bundles/org.openhab.binding.nikobus/src/main/java/org/openhab/binding/nikobus/internal/handler/NikobusPushButtonHandler.java b/bundles/org.openhab.binding.nikobus/src/main/java/org/openhab/binding/nikobus/internal/handler/NikobusPushButtonHandler.java index aaa4e31f011..1b589514333 100644 --- a/bundles/org.openhab.binding.nikobus/src/main/java/org/openhab/binding/nikobus/internal/handler/NikobusPushButtonHandler.java +++ b/bundles/org.openhab.binding.nikobus/src/main/java/org/openhab/binding/nikobus/internal/handler/NikobusPushButtonHandler.java @@ -299,9 +299,9 @@ public class NikobusPushButtonHandler extends NikobusBaseThingHandler { processNext(currentTimeMillis); } - abstract protected void reset(long currentTimeMillis); + protected abstract void reset(long currentTimeMillis); - abstract protected void processNext(long currentTimeMillis); + protected abstract void processNext(long currentTimeMillis); } public static class TriggerButtonConfig { diff --git a/bundles/org.openhab.binding.nikobus/src/main/java/org/openhab/binding/nikobus/internal/handler/NikobusRollershutterModuleHandler.java b/bundles/org.openhab.binding.nikobus/src/main/java/org/openhab/binding/nikobus/internal/handler/NikobusRollershutterModuleHandler.java index 4b198b048c5..a33e43dd97e 100644 --- a/bundles/org.openhab.binding.nikobus/src/main/java/org/openhab/binding/nikobus/internal/handler/NikobusRollershutterModuleHandler.java +++ b/bundles/org.openhab.binding.nikobus/src/main/java/org/openhab/binding/nikobus/internal/handler/NikobusRollershutterModuleHandler.java @@ -294,8 +294,8 @@ public class NikobusRollershutterModuleHandler extends NikobusModuleHandler { final int up; final int down; - final static DirectionConfiguration NORMAL = new DirectionConfiguration(1, 2); - final static DirectionConfiguration REVERSED = new DirectionConfiguration(2, 1); + static final DirectionConfiguration NORMAL = new DirectionConfiguration(1, 2); + static final DirectionConfiguration REVERSED = new DirectionConfiguration(2, 1); private DirectionConfiguration(int up, int down) { this.up = up; diff --git a/bundles/org.openhab.binding.onkyo/src/main/java/org/openhab/binding/onkyo/internal/OnkyoBindingConstants.java b/bundles/org.openhab.binding.onkyo/src/main/java/org/openhab/binding/onkyo/internal/OnkyoBindingConstants.java index 0363fbab4f2..5e4536ff05c 100644 --- a/bundles/org.openhab.binding.onkyo/src/main/java/org/openhab/binding/onkyo/internal/OnkyoBindingConstants.java +++ b/bundles/org.openhab.binding.onkyo/src/main/java/org/openhab/binding/onkyo/internal/OnkyoBindingConstants.java @@ -90,10 +90,10 @@ public class OnkyoBindingConstants { public static final String CHANNEL_NET_MENU8 = "netmenu#item8"; public static final String CHANNEL_NET_MENU9 = "netmenu#item9"; - public final static String CHANNEL_AUDIO_IN_INFO = "info#audioIn"; - public final static String CHANNEL_AUDIO_OUT_INFO = "info#audioOut"; - public final static String CHANNEL_VIDEO_IN_INFO = "info#videoIn"; - public final static String CHANNEL_VIDEO_OUT_INFO = "info#videoOut"; + public static final String CHANNEL_AUDIO_IN_INFO = "info#audioIn"; + public static final String CHANNEL_AUDIO_OUT_INFO = "info#audioOut"; + public static final String CHANNEL_VIDEO_IN_INFO = "info#videoIn"; + public static final String CHANNEL_VIDEO_OUT_INFO = "info#videoOut"; // Used for Discovery service public static final String MANUFACTURER = "ONKYO"; diff --git a/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/communication/messages/PartitionCommand.java b/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/communication/messages/PartitionCommand.java index 2b855a1b280..14c8d0551b2 100644 --- a/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/communication/messages/PartitionCommand.java +++ b/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/communication/messages/PartitionCommand.java @@ -32,7 +32,7 @@ public enum PartitionCommand { DISARM(6), BEEP(8); - private final static Logger logger = LoggerFactory.getLogger(PartitionCommand.class); + private static final Logger logger = LoggerFactory.getLogger(PartitionCommand.class); private int command; diff --git a/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/util/ParadoxUtil.java b/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/util/ParadoxUtil.java index efac61c59fb..0f6768f2c45 100644 --- a/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/util/ParadoxUtil.java +++ b/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/util/ParadoxUtil.java @@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory; public class ParadoxUtil { private static final String SPACE_DELIMITER = " "; - private final static Logger logger = LoggerFactory.getLogger(ParadoxUtil.class); + private static final Logger logger = LoggerFactory.getLogger(ParadoxUtil.class); public static byte calculateChecksum(byte[] payload) { int result = 0; diff --git a/bundles/org.openhab.binding.paradoxalarm/src/test/java/org/openhab/binding/paradoxalarm/internal/TestGetBytes.java b/bundles/org.openhab.binding.paradoxalarm/src/test/java/org/openhab/binding/paradoxalarm/internal/TestGetBytes.java index f78b9cab780..5d571a17ec5 100644 --- a/bundles/org.openhab.binding.paradoxalarm/src/test/java/org/openhab/binding/paradoxalarm/internal/TestGetBytes.java +++ b/bundles/org.openhab.binding.paradoxalarm/src/test/java/org/openhab/binding/paradoxalarm/internal/TestGetBytes.java @@ -41,7 +41,7 @@ public class TestGetBytes { System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "TRACE"); } - private final static Logger logger = LoggerFactory.getLogger(ParadoxUtil.class); + private static final Logger logger = LoggerFactory.getLogger(ParadoxUtil.class); private static final byte[] EXPECTED1 = { (byte) 0xAA, 0x0A, 0x00, 0x03, 0x08, (byte) 0xF0, 0x00, 0x00, 0x01, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, 0x01, 0x02, 0x03, diff --git a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/command/input/Input.java b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/command/input/Input.java index 6b4b1de2806..5cae8b5d4eb 100644 --- a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/command/input/Input.java +++ b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/command/input/Input.java @@ -73,6 +73,7 @@ public class Input { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.plugwise/src/main/java/org/openhab/binding/plugwise/internal/protocol/field/MACAddress.java b/bundles/org.openhab.binding.plugwise/src/main/java/org/openhab/binding/plugwise/internal/protocol/field/MACAddress.java index 555898e021e..7a8fd2639c1 100644 --- a/bundles/org.openhab.binding.plugwise/src/main/java/org/openhab/binding/plugwise/internal/protocol/field/MACAddress.java +++ b/bundles/org.openhab.binding.plugwise/src/main/java/org/openhab/binding/plugwise/internal/protocol/field/MACAddress.java @@ -37,6 +37,7 @@ public class MACAddress { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.resol/src/main/java/org/openhab/binding/resol/handler/ResolThingHandler.java b/bundles/org.openhab.binding.resol/src/main/java/org/openhab/binding/resol/handler/ResolThingHandler.java index 3c30245c032..20dff6490e9 100644 --- a/bundles/org.openhab.binding.resol/src/main/java/org/openhab/binding/resol/handler/ResolThingHandler.java +++ b/bundles/org.openhab.binding.resol/src/main/java/org/openhab/binding/resol/handler/ResolThingHandler.java @@ -308,6 +308,7 @@ public class ResolThingHandler extends ResolBaseThingHandler { } /* check if the given value is a special one like 888.8 or 999.9 for shortcut or open load on a sensor wire */ + @SuppressWarnings("PMD.SimplifyBooleanReturns") private boolean isSpecialValue(Double dd) { if ((Math.abs(dd - 888.8) < 0.1) || (Math.abs(dd - (-888.8)) < 0.1)) { /* value out of range */ diff --git a/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/RFXComTestHelper.java b/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/RFXComTestHelper.java index 4784888738d..e7422fb1504 100644 --- a/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/RFXComTestHelper.java +++ b/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/RFXComTestHelper.java @@ -33,13 +33,13 @@ import org.openhab.core.thing.ThingUID; */ @NonNullByDefault public class RFXComTestHelper { - static final public ThingUID bridgeUID = new ThingUID("rfxcom", "tcpbridge", "rfxtrx0"); - static final public ThingUID thingUID = new ThingUID("rfxcom", bridgeUID, "mocked"); - static final public ThingTypeUID thingTypeUID = new ThingTypeUID("rfxcom", "raw"); + public static final ThingUID bridgeUID = new ThingUID("rfxcom", "tcpbridge", "rfxtrx0"); + public static final ThingUID thingUID = new ThingUID("rfxcom", bridgeUID, "mocked"); + public static final ThingTypeUID thingTypeUID = new ThingTypeUID("rfxcom", "raw"); - static final public ChannelUID commandChannelUID = new ChannelUID(thingUID, RFXComBindingConstants.CHANNEL_COMMAND); + public static final ChannelUID commandChannelUID = new ChannelUID(thingUID, RFXComBindingConstants.CHANNEL_COMMAND); - static public void basicBoundaryCheck(PacketType packetType, RFXComMessage message) throws RFXComException { + public static void basicBoundaryCheck(PacketType packetType, RFXComMessage message) throws RFXComException { // This is a place where its easy to make mistakes in coding, and can result in errors, normally // array bounds errors byte[] binaryMessage = message.decodeMessage(); @@ -47,7 +47,7 @@ public class RFXComTestHelper { assertEquals(packetType.toByte(), binaryMessage[1], "Wrong packet type"); } - static public int getActualIntValue(RFXComDeviceMessage msg, RFXComDeviceConfiguration config, String channelId) + public static int getActualIntValue(RFXComDeviceMessage msg, RFXComDeviceConfiguration config, String channelId) throws RFXComException { return ((DecimalType) msg.convertToState(channelId, config, new MockDeviceState())).intValue(); } diff --git a/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/messages/RFXComLighting4MessageTest.java b/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/messages/RFXComLighting4MessageTest.java index 35dfbd9fb18..22ce7c0c3d3 100644 --- a/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/messages/RFXComLighting4MessageTest.java +++ b/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/messages/RFXComLighting4MessageTest.java @@ -46,9 +46,9 @@ import org.openhab.core.util.HexUtils; */ @NonNullByDefault public class RFXComLighting4MessageTest { - static public final ChannelUID contactChannelUID = new ChannelUID(thingUID, CHANNEL_CONTACT); + public static final ChannelUID contactChannelUID = new ChannelUID(thingUID, CHANNEL_CONTACT); - static public void checkDiscoveryResult(RFXComDeviceMessage msg, String deviceId, + public static void checkDiscoveryResult(RFXComDeviceMessage msg, String deviceId, @Nullable Integer pulse, String subType) throws RFXComException { String thingUID = "homeduino:rfxcom:fssfsd:thing"; DiscoveryResultBuilder builder = DiscoveryResultBuilder.create(new ThingUID(thingUID)); diff --git a/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/rio/system/RioSystemConfig.java b/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/rio/system/RioSystemConfig.java index d782d25faec..2ff32001cd4 100644 --- a/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/rio/system/RioSystemConfig.java +++ b/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/rio/system/RioSystemConfig.java @@ -142,6 +142,7 @@ public class RioSystemConfig { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/handler/SamsungTvHandler.java b/bundles/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/handler/SamsungTvHandler.java index 2fa0d3da5cb..9ebf0fa002b 100644 --- a/bundles/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/handler/SamsungTvHandler.java +++ b/bundles/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/handler/SamsungTvHandler.java @@ -242,12 +242,12 @@ public class SamsungTvHandler extends BaseThingHandler implements RegistryListen boolean isOnline = false; for (Device device : upnpService.getRegistry().getDevices()) { - if (createService((RemoteDevice) device) == true) { + if (createService((RemoteDevice) device)) { isOnline = true; } } - if (isOnline == true) { + if (isOnline) { logger.debug("Device was online"); putOnline(); } else { diff --git a/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelMessage.java b/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelMessage.java index 282d94843d5..ff37573871d 100644 --- a/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelMessage.java +++ b/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelMessage.java @@ -158,6 +158,7 @@ public class SatelMessage { return String.format("Message: command = %02X, payload = %s", this.command, getPayloadAsHex()); } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyBindingConstants.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyBindingConstants.java index bd6fe5e7c6d..8b30cf31cac 100755 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyBindingConstants.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyBindingConstants.java @@ -188,8 +188,8 @@ public class ShellyBindingConstants { public static final String CHANNEL_ESENSOR_TEMP5 = CHANNEL_SENSOR_TEMP + "5"; public static final String CHANNEL_ESENSOR_HUMIDITY = CHANNEL_SENSOR_HUM; public static final String CHANNEL_ESENSOR_VOLTAGE = CHANNEL_SENSOR_VOLTAGE; - public static final String CHANNEL_ESENSOR_DIGITALINPUT = "digitalInput";; - public static final String CHANNEL_ESENSOR_ANALOGINPUT = "analogInput";; + public static final String CHANNEL_ESENSOR_DIGITALINPUT = "digitalInput"; + public static final String CHANNEL_ESENSOR_ANALOGINPUT = "analogInput"; public static final String CHANNEL_ESENSOR_INPUT = "input"; public static final String CHANNEL_ESENSOR_INPUT1 = CHANNEL_ESENSOR_INPUT + "1"; diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/MeterValue.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/MeterValue.java index c839f4a9861..464d6327e98 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/MeterValue.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/MeterValue.java @@ -74,6 +74,7 @@ public class MeterValue> { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/conformity/negate/NegateBitModel.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/conformity/negate/NegateBitModel.java index 5588e939f8f..54753348094 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/conformity/negate/NegateBitModel.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/conformity/negate/NegateBitModel.java @@ -66,6 +66,7 @@ public class NegateBitModel { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/handler/SqueezeBoxServerHandler.java b/bundles/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/handler/SqueezeBoxServerHandler.java index 3fc0ac89597..53fb46cd61b 100644 --- a/bundles/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/handler/SqueezeBoxServerHandler.java +++ b/bundles/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/handler/SqueezeBoxServerHandler.java @@ -939,7 +939,7 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler { boolean hasitems = "1".equals(entry.value); if (f != null) { // Except for some favorites (e.g. Spotify) use hasitems:1 and type:playlist - if (hasitems && isTypePlaylist == false) { + if (hasitems && !isTypePlaylist) { // Skip subfolders favorites.remove(f); f = null; diff --git a/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiBindingConstants.java b/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiBindingConstants.java index 313f5fe0093..73fec66b791 100644 --- a/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiBindingConstants.java +++ b/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiBindingConstants.java @@ -53,5 +53,5 @@ public class TACmiBindingConstants { "schema-state-ro"); // Channel specific configuration items - public final static String CHANNEL_CONFIG_OUTPUT = "output"; + public static final String CHANNEL_CONFIG_OUTPUT = "output"; } diff --git a/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/message/DigitalMessage.java b/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/message/DigitalMessage.java index 9f2d04d5aee..b40f21d5381 100644 --- a/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/message/DigitalMessage.java +++ b/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/message/DigitalMessage.java @@ -86,6 +86,7 @@ public final class DigitalMessage extends Message { * @param portNumber - the portNumber in Range 1-32 * @return */ + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean hasPortnumber(int portNumber) { if (podNumber == 0 && portNumber <= 16) { diff --git a/bundles/org.openhab.binding.tankerkoenig/src/main/java/org/openhab/binding/tankerkoenig/internal/handler/StationHandler.java b/bundles/org.openhab.binding.tankerkoenig/src/main/java/org/openhab/binding/tankerkoenig/internal/handler/StationHandler.java index 4a61bfee2df..8d93c6e221c 100644 --- a/bundles/org.openhab.binding.tankerkoenig/src/main/java/org/openhab/binding/tankerkoenig/internal/handler/StationHandler.java +++ b/bundles/org.openhab.binding.tankerkoenig/src/main/java/org/openhab/binding/tankerkoenig/internal/handler/StationHandler.java @@ -128,7 +128,7 @@ public class StationHandler extends BaseThingHandler { */ public void updateData(LittleStation station) { logger.debug("Update Tankerkoenig data '{}'", getThing().getUID()); - if (station.isOpen() == true) { + if (station.isOpen()) { logger.debug("Checked Station is open! '{}'", getThing().getUID()); updateState(CHANNEL_STATION_OPEN, OpenClosedType.OPEN); if (station.getDiesel() != null) { diff --git a/bundles/org.openhab.binding.touchwand/src/main/java/org/openhab/binding/touchwand/internal/dto/TouchWandUnitFromJson.java b/bundles/org.openhab.binding.touchwand/src/main/java/org/openhab/binding/touchwand/internal/dto/TouchWandUnitFromJson.java index 5b3c0256804..bfb44238043 100644 --- a/bundles/org.openhab.binding.touchwand/src/main/java/org/openhab/binding/touchwand/internal/dto/TouchWandUnitFromJson.java +++ b/bundles/org.openhab.binding.touchwand/src/main/java/org/openhab/binding/touchwand/internal/dto/TouchWandUnitFromJson.java @@ -34,7 +34,7 @@ import com.google.gson.JsonParser; @NonNullByDefault public class TouchWandUnitFromJson { - private final static Logger logger = LoggerFactory.getLogger(TouchWandUnitFromJson.class); + private static final Logger logger = LoggerFactory.getLogger(TouchWandUnitFromJson.class); public TouchWandUnitFromJson() { } diff --git a/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/handler/VelbusRelayWithInputHandler.java b/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/handler/VelbusRelayWithInputHandler.java index 005a70ac739..daf91de7d32 100644 --- a/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/handler/VelbusRelayWithInputHandler.java +++ b/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/handler/VelbusRelayWithInputHandler.java @@ -91,11 +91,7 @@ public class VelbusRelayWithInputHandler extends VelbusRelayHandler { private boolean isTriggerChannel(byte address, byte channel) { VelbusChannelIdentifier velbusChannelIdentifier = new VelbusChannelIdentifier(address, channel); - if (getModuleAddress().getChannelNumber(velbusChannelIdentifier) == 6) { - return true; - } else { - return false; - } + return getModuleAddress().getChannelNumber(velbusChannelIdentifier) == 6; } @Override diff --git a/bundles/org.openhab.binding.ventaair/src/main/java/org/openhab/binding/ventaair/internal/VentaThingHandler.java b/bundles/org.openhab.binding.ventaair/src/main/java/org/openhab/binding/ventaair/internal/VentaThingHandler.java index 1bac1d823dd..4c08b334cab 100644 --- a/bundles/org.openhab.binding.ventaair/src/main/java/org/openhab/binding/ventaair/internal/VentaThingHandler.java +++ b/bundles/org.openhab.binding.ventaair/src/main/java/org/openhab/binding/ventaair/internal/VentaThingHandler.java @@ -327,10 +327,8 @@ public class VentaThingHandler extends BaseThingHandler { } private boolean messageIsEmpty(DeviceInfoMessage message) { - if (message.getCurrentActions() == null && message.getInfo() == null && message.getMeasurements() == null) { - return true; - } - return false; + return (message.getCurrentActions() == null && message.getInfo() == null + && message.getMeasurements() == null); } /** diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureAlarmsDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureAlarmsDTO.java index 6bbc8aeb38b..e8d8d663a45 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureAlarmsDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureAlarmsDTO.java @@ -40,6 +40,7 @@ public class VerisureAlarmsDTO extends VerisureBaseThingDTO { return super.hashCode(); } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureBaseThingDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureBaseThingDTO.java index afa126f066d..2abe4b8c7d7 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureBaseThingDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureBaseThingDTO.java @@ -216,6 +216,7 @@ public abstract class VerisureBaseThingDTO implements VerisureThingDTO { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { @@ -343,6 +344,7 @@ public abstract class VerisureBaseThingDTO implements VerisureThingDTO { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureBroadbandConnectionsDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureBroadbandConnectionsDTO.java index e29eaba8219..d2735f4c416 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureBroadbandConnectionsDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureBroadbandConnectionsDTO.java @@ -39,6 +39,7 @@ public class VerisureBroadbandConnectionsDTO extends VerisureBaseThingDTO { return super.hashCode(); } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureDoorWindowsDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureDoorWindowsDTO.java index 3b59e6fe0bc..4d58ebe773a 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureDoorWindowsDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureDoorWindowsDTO.java @@ -126,6 +126,7 @@ public class VerisureDoorWindowsDTO extends VerisureBaseThingDTO { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureGatewayDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureGatewayDTO.java index 643b5a99785..0db463882aa 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureGatewayDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureGatewayDTO.java @@ -37,6 +37,7 @@ public class VerisureGatewayDTO extends VerisureBaseThingDTO { return super.hashCode(); } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureInstallationsDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureInstallationsDTO.java index feb609bfeb5..e462a6a9fb3 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureInstallationsDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureInstallationsDTO.java @@ -44,6 +44,7 @@ public class VerisureInstallationsDTO { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { @@ -92,6 +93,7 @@ public class VerisureInstallationsDTO { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureMiceDetectionDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureMiceDetectionDTO.java index d7026e20f10..394a5777396 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureMiceDetectionDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureMiceDetectionDTO.java @@ -67,6 +67,7 @@ public class VerisureMiceDetectionDTO extends VerisureBaseThingDTO { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureSmartLockDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureSmartLockDTO.java index 5862d9e4971..59b45181b1b 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureSmartLockDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureSmartLockDTO.java @@ -148,6 +148,7 @@ public class VerisureSmartLockDTO { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureSmartPlugsDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureSmartPlugsDTO.java index 034c4685680..c8b4f4645e6 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureSmartPlugsDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureSmartPlugsDTO.java @@ -39,6 +39,7 @@ public class VerisureSmartPlugsDTO extends VerisureBaseThingDTO { return super.hashCode(); } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureUserPresencesDTO.java b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureUserPresencesDTO.java index 0ee5c7fff17..63759ab8b0d 100644 --- a/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureUserPresencesDTO.java +++ b/bundles/org.openhab.binding.verisure/src/main/java/org/openhab/binding/verisure/internal/dto/VerisureUserPresencesDTO.java @@ -39,6 +39,7 @@ public class VerisureUserPresencesDTO extends VerisureBaseThingDTO { return super.hashCode(); } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/WemoUtil.java b/bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/WemoUtil.java index 0f4cad1e8a4..2c7425ffca2 100644 --- a/bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/WemoUtil.java +++ b/bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/WemoUtil.java @@ -131,7 +131,7 @@ public class WemoUtil { } public static String createBinaryStateContent(boolean binaryState) { - String binary = binaryState == true ? "1" : "0"; + String binary = binaryState ? "1" : "0"; String content = "" + "" + "" + "" + "" diff --git a/bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/handler/ZmBridgeHandler.java b/bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/handler/ZmBridgeHandler.java index 329553361a6..61b645db289 100644 --- a/bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/handler/ZmBridgeHandler.java +++ b/bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/handler/ZmBridgeHandler.java @@ -141,7 +141,7 @@ public class ZmBridgeHandler extends BaseBridgeHandler { defaultImageRefreshInterval = config.defaultImageRefreshInterval; backgroundDiscoveryEnabled = config.discoveryEnabled; - logger.debug("Bridge: Background discovery is {}", backgroundDiscoveryEnabled == true ? "ENABLED" : "DISABLED"); + logger.debug("Bridge: Background discovery is {}", backgroundDiscoveryEnabled ? "ENABLED" : "DISABLED"); host = config.host; useSSL = config.useSSL.booleanValue(); diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitChangeListener.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitChangeListener.java index fe36ba08eb4..35b5f26d79c 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitChangeListener.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitChangeListener.java @@ -60,9 +60,9 @@ import io.github.hapjava.server.impl.HomekitRoot; @NonNullByDefault public class HomekitChangeListener implements ItemRegistryChangeListener { private final Logger logger = LoggerFactory.getLogger(HomekitChangeListener.class); - private final static String REVISION_CONFIG = "revision"; - private final static String ACCESSORY_COUNT = "accessory_count"; - private final static String KNOWN_ACCESSORIES = "known_accessories"; + private static final String REVISION_CONFIG = "revision"; + private static final String ACCESSORY_COUNT = "accessory_count"; + private static final String KNOWN_ACCESSORIES = "known_accessories"; private final ItemRegistry itemRegistry; private final HomekitAccessoryRegistry accessoryRegistry = new HomekitAccessoryRegistry(); private final MetadataRegistry metadataRegistry; @@ -291,7 +291,6 @@ public class HomekitChangeListener implements ItemRegistryChangeListener { try { boolean changed = false; - boolean removed = false; for (final String name : pendingUpdates) { String oldValue = knownAccessories.get(name); accessoryRegistry.remove(name); diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitSettings.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitSettings.java index 7a60bac2197..daff50df52c 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitSettings.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitSettings.java @@ -66,6 +66,7 @@ public class HomekitSettings { return result; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java index 4c832748228..0669d3472fe 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java @@ -50,18 +50,18 @@ public class HomekitTaggedItem { private final Logger logger = LoggerFactory.getLogger(HomekitTaggedItem.class); /** configuration keywords at items level **/ - public final static String DELAY = "commandDelay"; - public final static String DIMMER_MODE = "dimmerMode"; + public static final String DELAY = "commandDelay"; + public static final String DIMMER_MODE = "dimmerMode"; public static final String BATTERY_LOW_THRESHOLD = "lowThreshold"; - public final static String INSTANCE = "instance"; - public final static String INVERTED = "inverted"; - public final static String MAX_VALUE = "maxValue"; - public final static String MIN_VALUE = "minValue"; - public final static String PRIMARY_SERVICE = "primary"; - public final static String STEP = "step"; - public final static String UNIT = "unit"; - public final static String EMULATE_STOP_STATE = "stop"; - public final static String EMULATE_STOP_SAME_DIRECTION = "stopSameDirection"; + public static final String INSTANCE = "instance"; + public static final String INVERTED = "inverted"; + public static final String MAX_VALUE = "maxValue"; + public static final String MIN_VALUE = "minValue"; + public static final String PRIMARY_SERVICE = "primary"; + public static final String STEP = "step"; + public static final String UNIT = "unit"; + public static final String EMULATE_STOP_STATE = "stop"; + public static final String EMULATE_STOP_SAME_DIRECTION = "stopSameDirection"; private static final Map CREATED_ACCESSORY_IDS = new ConcurrentHashMap<>(); diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAccessoryFactory.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAccessoryFactory.java index d7b20037b93..d8a20b53525 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAccessoryFactory.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAccessoryFactory.java @@ -63,10 +63,10 @@ import io.github.hapjava.characteristics.impl.common.NameCharacteristic; @NonNullByDefault public class HomekitAccessoryFactory { private static final Logger logger = LoggerFactory.getLogger(HomekitAccessoryFactory.class); - public final static String METADATA_KEY = "homekit"; // prefix for HomeKit meta information in items.xml + public static final String METADATA_KEY = "homekit"; // prefix for HomeKit meta information in items.xml /** List of mandatory attributes for each accessory type. **/ - private final static Map MANDATORY_CHARACTERISTICS = new HashMap() { + private static final Map MANDATORY_CHARACTERISTICS = new HashMap() { { put(ACCESSORY_GROUP, new HomekitCharacteristicType[] {}); put(LEAK_SENSOR, new HomekitCharacteristicType[] { LEAK_DETECTED_STATE }); @@ -112,7 +112,7 @@ public class HomekitAccessoryFactory { }; /** List of service implementation for each accessory type. **/ - private final static Map> SERVICE_IMPL_MAP = new HashMap>() { + private static final Map> SERVICE_IMPL_MAP = new HashMap>() { { put(ACCESSORY_GROUP, HomekitAccessoryGroupImpl.class); put(LEAK_SENSOR, HomekitLeakSensorImpl.class); @@ -436,8 +436,9 @@ public class HomekitAccessoryFactory { MetadataRegistry metadataRegistry, HomekitAccessoryUpdater updater, HomekitSettings settings, Set ancestorServices) throws HomekitException { final var item = taggedItem.getItem(); - if (!(item instanceof GroupItem)) + if (!(item instanceof GroupItem)) { return; + } for (var groupMember : ((GroupItem) item).getMembers().stream() .sorted((lhs, rhs) -> lhs.getName().compareTo(rhs.getName())).collect(Collectors.toList())) { @@ -446,8 +447,9 @@ public class HomekitAccessoryFactory { .collect(Collectors.toList()); logger.trace("accessory types for {} are {}", groupMember.getName(), accessoryTypes); - if (accessoryTypes.isEmpty()) + if (accessoryTypes.isEmpty()) { continue; + } if (accessoryTypes.size() > 1) { logger.warn("Item {} is a HomeKit sub-accessory, but multiple accessory types are not allowed.", diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java index 0f2ca14d55d..6216f3a9092 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java @@ -162,7 +162,7 @@ public class HomekitCharacteristicFactory { private static final Logger logger = LoggerFactory.getLogger(HomekitCharacteristicFactory.class); // List of optional characteristics and corresponding method to create them. - private final static Map> optional = new HashMap>() { + private static final Map> optional = new HashMap>() { { put(NAME, HomekitCharacteristicFactory::createNameCharacteristic); put(BATTERY_LOW_STATUS, HomekitCharacteristicFactory::createStatusLowBatteryCharacteristic); diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitHumiditySensorImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitHumiditySensorImpl.java index e09bfd63297..aa4728a36f0 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitHumiditySensorImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitHumiditySensorImpl.java @@ -32,7 +32,7 @@ import io.github.hapjava.services.impl.HumiditySensorService; * @author Andy Lintner - Initial contribution */ public class HomekitHumiditySensorImpl extends AbstractHomekitAccessoryImpl implements HumiditySensorAccessory { - private final static String CONFIG_MULTIPLICATOR = "homekitMultiplicator"; + private static final String CONFIG_MULTIPLICATOR = "homekitMultiplicator"; public HomekitHumiditySensorImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) { diff --git a/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java b/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java index 245d2a36b84..50706c700a7 100644 --- a/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java +++ b/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java @@ -106,7 +106,7 @@ public class DynamoDBPersistenceService implements QueryablePersistenceService { private ItemRegistry itemRegistry; private @Nullable DynamoDbEnhancedAsyncClient client; private @Nullable DynamoDbAsyncClient lowLevelClient; - private final static Logger logger = LoggerFactory.getLogger(DynamoDBPersistenceService.class); + private static final Logger logger = LoggerFactory.getLogger(DynamoDBPersistenceService.class); private boolean isProperlyConfigured; private @Nullable DynamoDBConfig dbConfig; private @Nullable DynamoDBTableNameResolver tableNameResolver; diff --git a/bundles/org.openhab.persistence.dynamodb/src/test/java/org/openhab/persistence/dynamodb/internal/BaseIntegrationTest.java b/bundles/org.openhab.persistence.dynamodb/src/test/java/org/openhab/persistence/dynamodb/internal/BaseIntegrationTest.java index adb029a5e4b..f3e5d38bdec 100644 --- a/bundles/org.openhab.persistence.dynamodb/src/test/java/org/openhab/persistence/dynamodb/internal/BaseIntegrationTest.java +++ b/bundles/org.openhab.persistence.dynamodb/src/test/java/org/openhab/persistence/dynamodb/internal/BaseIntegrationTest.java @@ -93,7 +93,7 @@ public class BaseIntegrationTest extends JavaTest { protected static final Unit DIMENSIONLESS_ITEM_UNIT = Units.ONE; private static @Nullable URI endpointOverride; - protected static UnitProvider UNIT_PROVIDER; + protected static final UnitProvider UNIT_PROVIDER; static { ComponentContext context = Mockito.mock(ComponentContext.class); BundleContext bundleContext = Mockito.mock(BundleContext.class); @@ -192,7 +192,7 @@ public class BaseIntegrationTest extends JavaTest { * @param tablePrefix * @return new persistence service */ - protected synchronized static DynamoDBPersistenceService newService(@Nullable Boolean legacy, boolean cleanLocal, + protected static synchronized DynamoDBPersistenceService newService(@Nullable Boolean legacy, boolean cleanLocal, @Nullable URI overrideLocalURI, @Nullable String table, @Nullable String tablePrefix) { final DynamoDBPersistenceService service; Map config = getConfig(legacy, table, tablePrefix); diff --git a/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/Influx2FilterCriteriaQueryCreatorImpl.java b/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/Influx2FilterCriteriaQueryCreatorImpl.java index 233b980545f..ff390529664 100644 --- a/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/Influx2FilterCriteriaQueryCreatorImpl.java +++ b/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/Influx2FilterCriteriaQueryCreatorImpl.java @@ -73,11 +73,12 @@ public class Influx2FilterCriteriaQueryCreatorImpl implements FilterCriteriaQuer flux = flux.filter(tag(TAG_ITEM_NAME).equal(itemName)); } - if (needsToUseItemTagName) + if (needsToUseItemTagName) { flux = flux.keep(new String[] { FIELD_MEASUREMENT_NAME, COLUMN_TIME_NAME_V2, COLUMN_VALUE_NAME_V2, TAG_ITEM_NAME }); - else + } else { flux = flux.keep(new String[] { FIELD_MEASUREMENT_NAME, COLUMN_TIME_NAME_V2, COLUMN_VALUE_NAME_V2 }); + } } if (criteria.getState() != null && criteria.getOperator() != null) { diff --git a/bundles/org.openhab.transform.scale/src/main/java/org/openhab/transform/scale/internal/Range.java b/bundles/org.openhab.transform.scale/src/main/java/org/openhab/transform/scale/internal/Range.java index 70cb1f222be..36826ba15a2 100644 --- a/bundles/org.openhab.transform.scale/src/main/java/org/openhab/transform/scale/internal/Range.java +++ b/bundles/org.openhab.transform.scale/src/main/java/org/openhab/transform/scale/internal/Range.java @@ -74,6 +74,7 @@ public class Range { this.maxInclusive = maxInclusive; } + @SuppressWarnings("PMD.SimplifyBooleanReturns") public boolean contains(final BigDecimal value) { final boolean minMatch; if (min == null) {