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:
parent
b67b9fcb25
commit
589400e223
|
@ -50,6 +50,7 @@ public abstract class State {
|
|||
/**
|
||||
* Sets a new state in the state machine.
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public synchronized void nextState(Function<StateMachine, ? extends State> nextState) {
|
||||
if (context.getState() != this) { // compare identity
|
||||
return;
|
||||
|
|
|
@ -137,6 +137,7 @@ public class PacketCapturingService {
|
|||
* @param packet The packet to be checked
|
||||
* @return Returns true, if the packet should be captured, otherwise false
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
private boolean shouldCapture(final Packet packet) {
|
||||
if (packet.contains(ArpPacket.class)) {
|
||||
ArpPacket arpPacket = packet.get(ArpPacket.class);
|
||||
|
|
|
@ -173,7 +173,7 @@ public class AccountServlet extends HttpServlet {
|
|||
+ uri.substring(PROXY_URI_PART.length());
|
||||
|
||||
String postData = null;
|
||||
if (verb == "POST" || verb == "PUT") {
|
||||
if ("POST".equals(verb) || "PUT".equals(verb)) {
|
||||
postData = req.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
|
||||
}
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ public class FlashBriefingProfileHandler extends BaseThingHandler {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public boolean initialize(AccountHandler handler, String currentConfigurationJson) {
|
||||
updateState(CHANNEL_SAVE, OnOffType.OFF);
|
||||
if (updatePlayOnDevice) {
|
||||
|
|
|
@ -319,6 +319,7 @@ public class SocketChannelSession implements SocketSession {
|
|||
* Stops the reader. Will wait 5 seconds for the runnable to stop (should stop within 1 second based on the poll
|
||||
* timeout below)
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void stopRunning() {
|
||||
if (isRunning.getAndSet(false)) {
|
||||
// only wait if stopRunning didn't get called as part of processing a message
|
||||
|
|
|
@ -1088,7 +1088,7 @@ class AtlonaPro3PortocolHandler {
|
|||
|
||||
@Override
|
||||
public void responseReceived(String response) {
|
||||
if (response == null || response == "") {
|
||||
if (response == null || response.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -554,6 +554,6 @@ public class AutelisHandler extends BaseThingHandler {
|
|||
}
|
||||
|
||||
private boolean isJandy() {
|
||||
return getThing().getThingTypeUID() == AutelisBindingConstants.JANDY_THING_TYPE_UID;
|
||||
return AutelisBindingConstants.JANDY_THING_TYPE_UID.equals(getThing().getThingTypeUID());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ public class BlueZBluetoothDevice extends BaseBluetoothDevice implements BlueZEv
|
|||
logger.debug("Creating DBusBlueZ device with address '{}'", address);
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public synchronized void updateBlueZDevice(@Nullable BluetoothDevice blueZDevice) {
|
||||
if (this.device != null && this.device == blueZDevice) {
|
||||
return;
|
||||
|
|
|
@ -104,6 +104,7 @@ public class RoamingBluetoothDevice extends DelegateBluetoothDevice {
|
|||
return getAdapter(currentDelegateRef.get());
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
private class Listener implements BluetoothDeviceListener {
|
||||
|
||||
private BluetoothDevice device;
|
||||
|
|
|
@ -143,6 +143,7 @@ public class RoamingBridgeHandler extends BaseBridgeHandler implements RoamingBl
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void addBluetoothAdapter(BluetoothAdapter adapter) {
|
||||
if (adapter == this) {
|
||||
return;
|
||||
|
@ -164,6 +165,7 @@ public class RoamingBridgeHandler extends BaseBridgeHandler implements RoamingBl
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void removeBluetoothAdapter(BluetoothAdapter adapter) {
|
||||
if (adapter == this) {
|
||||
return;
|
||||
|
|
|
@ -109,6 +109,7 @@ public class ConnectedBluetoothHandler extends BeaconBluetoothHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void dispose() {
|
||||
cancel(reconnectJob, true);
|
||||
reconnectJob = null;
|
||||
|
@ -181,6 +182,7 @@ public class ConnectedBluetoothHandler extends BeaconBluetoothHandler {
|
|||
return characteristic;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
private <T> CompletableFuture<T> executeWithConnection(UUID serviceUUID, UUID characteristicUUID,
|
||||
Function<BluetoothCharacteristic, CompletableFuture<T>> callable) {
|
||||
if (connectionTaskExecutor == scheduler) {
|
||||
|
|
|
@ -67,6 +67,7 @@ public class HeritableFuture<T> extends CompletableFuture<T> {
|
|||
return new HeritableFuture<>(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
protected void setParentFuture(Supplier<@Nullable Future<?>> futureSupplier) {
|
||||
synchronized (futureLock) {
|
||||
var future = futureSupplier.get();
|
||||
|
|
|
@ -291,7 +291,7 @@ public class ConnectedDriveProxy {
|
|||
ContentResponse authResponse = authRequest.timeout(HTTP_TIMEOUT_SEC, TimeUnit.SECONDS).send();
|
||||
String authResponseString = URLDecoder.decode(authResponse.getContentAsString(), Charset.defaultCharset());
|
||||
String authCode = getAuthCode(authResponseString);
|
||||
if (authCode != Constants.EMPTY) {
|
||||
if (!Constants.EMPTY.equals(authCode)) {
|
||||
MultiMap<String> codeChallenge = getTokenBaseValues();
|
||||
codeChallenge.put(AUTHORIZATION, authCode);
|
||||
|
||||
|
|
|
@ -171,11 +171,11 @@ public class Enums {
|
|||
* @return the enum value representing the given measure unit
|
||||
*/
|
||||
public static MeasureUnit fromUnit(Unit<?> unit) {
|
||||
if (unit == SIUnits.CELSIUS) {
|
||||
if (SIUnits.CELSIUS.equals(unit)) {
|
||||
return CELSIUS;
|
||||
} else if (unit == ImperialUnits.FAHRENHEIT) {
|
||||
} else if (ImperialUnits.FAHRENHEIT.equals(unit)) {
|
||||
return FAHRENHEIT;
|
||||
} else if (unit == Units.PERCENT) {
|
||||
} else if (Units.PERCENT.equals(unit)) {
|
||||
return PERCENTAGE;
|
||||
} else {
|
||||
return DIMENSIONLESS;
|
||||
|
|
|
@ -235,7 +235,7 @@ public abstract class CaddxBaseThingHandler extends BaseThingHandler {
|
|||
List<Channel> channels = getThing().getChannels();
|
||||
|
||||
for (Channel ch : channels) {
|
||||
if (channelUID == ch.getUID()) {
|
||||
if (channelUID.equals(ch.getUID())) {
|
||||
channel = ch;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -786,6 +786,7 @@ public enum ComfoAirCommandType {
|
|||
* new state
|
||||
* @return initialized ComfoAirCommand
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public static @Nullable ComfoAirCommand getChangeCommand(String key, Command command) {
|
||||
ComfoAirCommandType commandType = getCommandTypeByKey(key);
|
||||
State value = UnDefType.NULL;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -314,7 +314,7 @@ public class TunableWhiteThingHandler extends DmxThingHandler {
|
|||
|
||||
private void updateCurrentBrightnessAndTemperature() {
|
||||
currentBrightness = Util.toPercentValue(Util.toDmxValue(currentValues.get(0) + currentValues.get(1)));
|
||||
if (currentBrightness != PercentType.ZERO) {
|
||||
if (!PercentType.ZERO.equals(currentBrightness)) {
|
||||
currentColorTemperature = new PercentType(
|
||||
100 * currentValues.get(1) / (currentValues.get(0) + currentValues.get(1)));
|
||||
}
|
||||
|
|
|
@ -322,7 +322,7 @@ public abstract class DSCAlarmBaseThingHandler extends BaseThingHandler {
|
|||
List<Channel> channels = getThing().getChannels();
|
||||
|
||||
for (Channel ch : channels) {
|
||||
if (channelUID == ch.getUID()) {
|
||||
if (ch.getUID().equals(channelUID)) {
|
||||
channel = ch;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -100,40 +100,34 @@ public class KeypadThingHandler extends DSCAlarmBaseThingHandler {
|
|||
String[] channelTypes = { KEYPAD_READY_LED, KEYPAD_ARMED_LED, KEYPAD_MEMORY_LED, KEYPAD_BYPASS_LED,
|
||||
KEYPAD_TROUBLE_LED, KEYPAD_PROGRAM_LED, KEYPAD_FIRE_LED, KEYPAD_BACKLIGHT_LED };
|
||||
|
||||
String channel;
|
||||
ChannelUID channelUID = null;
|
||||
DSCAlarmCode dscAlarmCode = DSCAlarmCode
|
||||
.getDSCAlarmCodeValue(dscAlarmMessage.getMessageInfo(DSCAlarmMessageInfoType.CODE));
|
||||
|
||||
int bitCount = 8;
|
||||
int bitField = Integer.decode("0x" + dscAlarmMessage.getMessageInfo(DSCAlarmMessageInfoType.DATA));
|
||||
int[] masks = { 1, 2, 4, 8, 16, 32, 64, 128 };
|
||||
int[] bits = new int[8];
|
||||
int[] bits = new int[bitCount];
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < bitCount; i++) {
|
||||
bits[i] = bitField & masks[i];
|
||||
|
||||
channel = channelTypes[i];
|
||||
|
||||
if (channel != "") {
|
||||
channelUID = new ChannelUID(getThing().getUID(), channel);
|
||||
|
||||
switch (dscAlarmCode) {
|
||||
case KeypadLEDState: /* 510 */
|
||||
updateChannel(channelUID, bits[i] != 0 ? 1 : 0, "");
|
||||
break;
|
||||
case KeypadLEDFlashState: /* 511 */
|
||||
if (bits[i] != 0) {
|
||||
updateChannel(channelUID, 2, "");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ChannelUID channelUID = new ChannelUID(getThing().getUID(), channelTypes[i]);
|
||||
switch (dscAlarmCode) {
|
||||
case KeypadLEDState: /* 510 */
|
||||
updateChannel(channelUID, bits[i] != 0 ? 1 : 0, "");
|
||||
break;
|
||||
case KeypadLEDFlashState: /* 511 */
|
||||
if (bits[i] != 0) {
|
||||
updateChannel(channelUID, 2, "");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void dscAlarmEventReceived(EventObject event, Thing thing) {
|
||||
if (thing != null) {
|
||||
if (getThing() == thing) {
|
||||
|
|
|
@ -257,19 +257,11 @@ public class PanelThingHandler extends DSCAlarmBaseThingHandler {
|
|||
* @param timeStamp
|
||||
*/
|
||||
private void setTimeStampState(String timeStamp) {
|
||||
int state = 0;
|
||||
ChannelUID channelUID = new ChannelUID(getThing().getUID(), PANEL_TIME_STAMP);
|
||||
|
||||
boolean isTimeStamp = timeStamp != "";
|
||||
|
||||
if ((timeStamp == "" && !isTimeStamp) || (timeStamp != "" && isTimeStamp)) {
|
||||
logger.debug("setTimeStampState(): Already Set: {}", timeStamp);
|
||||
return;
|
||||
} else if (timeStamp != "") {
|
||||
state = 1;
|
||||
if (timeStamp != null) {
|
||||
ChannelUID channelUID = new ChannelUID(getThing().getUID(), PANEL_TIME_STAMP);
|
||||
int state = timeStamp.isEmpty() ? 0 : 1;
|
||||
updateChannel(channelUID, state, "");
|
||||
}
|
||||
|
||||
updateChannel(channelUID, state, "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -391,19 +383,15 @@ public class PanelThingHandler extends DSCAlarmBaseThingHandler {
|
|||
String channel;
|
||||
ChannelUID channelUID = null;
|
||||
|
||||
int bitCount = 8;
|
||||
int bitField = Integer.decode("0x" + dscAlarmMessage.getMessageInfo(DSCAlarmMessageInfoType.DATA));
|
||||
int[] masks = { 1, 2, 4, 8, 16, 32, 64, 128 };
|
||||
int[] bits = new int[8];
|
||||
int[] bits = new int[bitCount];
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < bitCount; i++) {
|
||||
channelUID = new ChannelUID(getThing().getUID(), channelTypes[i]);
|
||||
bits[i] = bitField & masks[i];
|
||||
|
||||
channel = channelTypes[i];
|
||||
|
||||
if (channel != "") {
|
||||
channelUID = new ChannelUID(getThing().getUID(), channel);
|
||||
updateChannel(channelUID, bits[i] != 0 ? 1 : 0, "");
|
||||
}
|
||||
updateChannel(channelUID, bits[i] != 0 ? 1 : 0, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -436,6 +424,7 @@ public class PanelThingHandler extends DSCAlarmBaseThingHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void dscAlarmEventReceived(EventObject event, Thing thing) {
|
||||
if (thing != null) {
|
||||
DSCAlarmEvent dscAlarmEvent = (DSCAlarmEvent) event;
|
||||
|
|
|
@ -184,6 +184,7 @@ public class PartitionThingHandler extends DSCAlarmBaseThingHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void dscAlarmEventReceived(EventObject event, Thing thing) {
|
||||
if (thing != null) {
|
||||
if (getThing() == thing) {
|
||||
|
|
|
@ -223,6 +223,7 @@ public class DSMRSerialAutoDevice implements DSMRDevice, DSMREventListener {
|
|||
/**
|
||||
* Switches the baudrate on the serial port.
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
private void switchBaudrate() {
|
||||
if (lastSwitchedBaudrateNanos + SWITCHING_BAUDRATE_TIMEOUT_NANOS > System.nanoTime()) {
|
||||
// Ignore switching baudrate if this is called within the timeout after a previous switch.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
package org.openhab.binding.dwdunwetter.internal.dto;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Comperator to sort a Warning first by Severity, second by the onSet date.
|
||||
|
@ -28,7 +29,7 @@ public class SeverityComparator implements Comparator<DwdWarningData> {
|
|||
|
||||
int result = Integer.compare(o1.getSeverity().getOrder(), o2.getSeverity().getOrder());
|
||||
if (result == 0) {
|
||||
if (o1.getOnset() == o2.getOnset()) {
|
||||
if (Objects.equals(o1.getOnset(), o2.getOnset())) {
|
||||
return 0;
|
||||
} else if (o1.getOnset() == null) {
|
||||
return -1;
|
||||
|
|
|
@ -193,27 +193,28 @@ public class SelectionDTO {
|
|||
this.includeRuntime = Boolean.TRUE;
|
||||
this.includeSensors = Boolean.TRUE;
|
||||
|
||||
this.includeAudio = selection.includeAudio == Boolean.TRUE ? Boolean.TRUE : includeAudio;
|
||||
this.includeDevice = selection.includeDevice == Boolean.TRUE ? Boolean.TRUE : includeDevice;
|
||||
this.includeElectricity = selection.includeElectricity == Boolean.TRUE ? Boolean.TRUE : includeElectricity;
|
||||
this.includeEnergy = selection.includeEnergy == Boolean.TRUE ? Boolean.TRUE : includeEnergy;
|
||||
this.includeExtendedRuntime = selection.includeExtendedRuntime == Boolean.TRUE ? Boolean.TRUE
|
||||
this.includeAudio = Boolean.TRUE.equals(selection.includeAudio) ? Boolean.TRUE : includeAudio;
|
||||
this.includeDevice = Boolean.TRUE.equals(selection.includeDevice) ? Boolean.TRUE : includeDevice;
|
||||
this.includeElectricity = Boolean.TRUE.equals(selection.includeElectricity) ? Boolean.TRUE : includeElectricity;
|
||||
this.includeEnergy = Boolean.TRUE.equals(selection.includeEnergy) ? Boolean.TRUE : includeEnergy;
|
||||
this.includeExtendedRuntime = Boolean.TRUE.equals(selection.includeExtendedRuntime) ? Boolean.TRUE
|
||||
: includeExtendedRuntime;
|
||||
this.includeHouseDetails = selection.includeHouseDetails == Boolean.TRUE ? Boolean.TRUE : includeHouseDetails;
|
||||
this.includeLocation = selection.includeLocation == Boolean.TRUE ? Boolean.TRUE : includeLocation;
|
||||
this.includeManagement = selection.includeManagement == Boolean.TRUE ? Boolean.TRUE : includeManagement;
|
||||
this.includeNotificationSettings = selection.includeNotificationSettings == Boolean.TRUE ? Boolean.TRUE
|
||||
this.includeHouseDetails = Boolean.TRUE.equals(selection.includeHouseDetails) ? Boolean.TRUE
|
||||
: includeHouseDetails;
|
||||
this.includeLocation = Boolean.TRUE.equals(selection.includeLocation) ? Boolean.TRUE : includeLocation;
|
||||
this.includeManagement = Boolean.TRUE.equals(selection.includeManagement) ? Boolean.TRUE : includeManagement;
|
||||
this.includeNotificationSettings = Boolean.TRUE.equals(selection.includeNotificationSettings) ? Boolean.TRUE
|
||||
: includeNotificationSettings;
|
||||
this.includeOemCfg = selection.includeOemCfg == Boolean.TRUE ? Boolean.TRUE : includeOemCfg;
|
||||
this.includePrivacy = selection.includePrivacy == Boolean.TRUE ? Boolean.TRUE : includePrivacy;
|
||||
this.includeReminders = selection.includeReminders == Boolean.TRUE ? Boolean.TRUE : includeReminders;
|
||||
this.includeSecuritySettings = selection.includeSecuritySettings == Boolean.TRUE ? Boolean.TRUE
|
||||
this.includeOemCfg = Boolean.TRUE.equals(selection.includeOemCfg) ? Boolean.TRUE : includeOemCfg;
|
||||
this.includePrivacy = Boolean.TRUE.equals(selection.includePrivacy) ? Boolean.TRUE : includePrivacy;
|
||||
this.includeReminders = Boolean.TRUE.equals(selection.includeReminders) ? Boolean.TRUE : includeReminders;
|
||||
this.includeSecuritySettings = Boolean.TRUE.equals(selection.includeSecuritySettings) ? Boolean.TRUE
|
||||
: includeSecuritySettings;
|
||||
this.includeSettings = selection.includeSettings == Boolean.TRUE ? Boolean.TRUE : includeSettings;
|
||||
this.includeTechnician = selection.includeTechnician == Boolean.TRUE ? Boolean.TRUE : includeTechnician;
|
||||
this.includeUtility = selection.includeUtility == Boolean.TRUE ? Boolean.TRUE : includeUtility;
|
||||
this.includeVersion = selection.includeVersion == Boolean.TRUE ? Boolean.TRUE : includeVersion;
|
||||
this.includeWeather = selection.includeWeather == Boolean.TRUE ? Boolean.TRUE : includeWeather;
|
||||
this.includeSettings = Boolean.TRUE.equals(selection.includeSettings) ? Boolean.TRUE : includeSettings;
|
||||
this.includeTechnician = Boolean.TRUE.equals(selection.includeTechnician) ? Boolean.TRUE : includeTechnician;
|
||||
this.includeUtility = Boolean.TRUE.equals(selection.includeUtility) ? Boolean.TRUE : includeUtility;
|
||||
this.includeVersion = Boolean.TRUE.equals(selection.includeVersion) ? Boolean.TRUE : includeVersion;
|
||||
this.includeWeather = Boolean.TRUE.equals(selection.includeWeather) ? Boolean.TRUE : includeWeather;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ public class Command implements Delayed {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public int compareTo(Delayed delayed) {
|
||||
if (delayed == this) {
|
||||
return 0;
|
||||
|
|
|
@ -30,6 +30,7 @@ public class DelayedCommand extends Command {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public int compareTo(Delayed delayed) {
|
||||
if (delayed == this) {
|
||||
return 0;
|
||||
|
|
|
@ -49,7 +49,7 @@ public class A5_3F_7F_Universal extends _4BSMessage {
|
|||
String c = Transformation.transform(transformationInfo.transformationType,
|
||||
transformationInfo.transformationFunction, command.toString());
|
||||
|
||||
if (c != null && c != command.toString()) {
|
||||
if (c != null && !c.equals(command.toString())) {
|
||||
setData(HexUtils.hexToBytes(c));
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ public class Ipx800v3Handler extends BaseThingHandler implements Ipx800EventList
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void run() {
|
||||
PortData currentData = portDatas.get(port);
|
||||
if (currentData != null && currentData.getValue() == 1 && currentData.getTimestamp() == referenceTime) {
|
||||
|
|
|
@ -103,7 +103,7 @@ public class LocationMessage {
|
|||
* @return Conversion result
|
||||
*/
|
||||
public State getTrackerLocation() {
|
||||
if (latitude != BigDecimal.ZERO && longitude != BigDecimal.ZERO) {
|
||||
if (!BigDecimal.ZERO.equals(latitude) && !BigDecimal.ZERO.equals(longitude)) {
|
||||
return new PointType(new DecimalType(latitude), new DecimalType(longitude));
|
||||
}
|
||||
return UnDefType.UNDEF;
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
@ -277,8 +278,8 @@ public class GreeAirDevice {
|
|||
// If commanding Fahrenheit set halfStep to 1 or 0 to tell the A/C which F integer
|
||||
// temperature to use as celsius alone is ambigious
|
||||
double newVal = temp.doubleValue();
|
||||
int CorF = temp.getUnit() == SIUnits.CELSIUS ? TEMP_UNIT_CELSIUS : TEMP_UNIT_FAHRENHEIT; // 0=Celsius,
|
||||
// 1=Fahrenheit
|
||||
int CorF = SIUnits.CELSIUS.equals(temp.getUnit()) ? TEMP_UNIT_CELSIUS : TEMP_UNIT_FAHRENHEIT; // 0=Celsius,
|
||||
// 1=Fahrenheit
|
||||
if (((CorF == TEMP_UNIT_CELSIUS) && (newVal < TEMP_MIN_C || newVal > TEMP_MAX_C))
|
||||
|| ((CorF == TEMP_UNIT_FAHRENHEIT) && (newVal < TEMP_MIN_F || newVal > TEMP_MAX_F))) {
|
||||
throw new IllegalArgumentException("Temp Value out of Range");
|
||||
|
@ -404,7 +405,7 @@ public class GreeAirDevice {
|
|||
}
|
||||
|
||||
// Finally Compare the values
|
||||
return currvalList.get(currvalueArrayposition) != prevvalList.get(prevvalueArrayposition);
|
||||
return !Objects.equals(currvalList.get(currvalueArrayposition), prevvalList.get(prevvalueArrayposition));
|
||||
}
|
||||
|
||||
protected void executeCommand(DatagramSocket clientSocket, Map<String, Integer> parameters) throws GreeException {
|
||||
|
|
|
@ -170,7 +170,7 @@ public class HaywardDiscoveryService extends AbstractDiscoveryService implements
|
|||
List<String> names;
|
||||
|
||||
// Set Virtual Heater Name
|
||||
if (thingType == HaywardBindingConstants.THING_TYPE_VIRTUALHEATER) {
|
||||
if (HaywardBindingConstants.THING_TYPE_VIRTUALHEATER.equals(thingType)) {
|
||||
names = new ArrayList<>(systemIDs);
|
||||
Collections.fill(names, "Heater");
|
||||
} else {
|
||||
|
|
|
@ -309,6 +309,7 @@ public class HeliosVentilationDataPoint {
|
|||
*
|
||||
* @param next is the sister datapoint
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void append(HeliosVentilationDataPoint next) {
|
||||
HeliosVentilationDataPoint existing = this.next;
|
||||
if (this == next) {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class OnOffTypeConverter extends AbstractTypeConverter<OnOffType> {
|
|||
|
||||
@Override
|
||||
protected OnOffType fromBinding(HmDatapoint dp) throws ConverterException {
|
||||
return (((Boolean) dp.getValue()) == Boolean.FALSE) != isInvert(dp) ? OnOffType.OFF : OnOffType.ON;
|
||||
return Boolean.FALSE.equals(dp.getValue()) != isInvert(dp) ? OnOffType.OFF : OnOffType.ON;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,8 +42,7 @@ public class OpenClosedTypeConverter extends AbstractTypeConverter<OpenClosedTyp
|
|||
|
||||
@Override
|
||||
protected OpenClosedType fromBinding(HmDatapoint dp) throws ConverterException {
|
||||
return (((Boolean) dp.getValue()) == Boolean.FALSE) != isInvert(dp) ? OpenClosedType.CLOSED
|
||||
: OpenClosedType.OPEN;
|
||||
return Boolean.FALSE.equals(dp.getValue()) != isInvert(dp) ? OpenClosedType.CLOSED : OpenClosedType.OPEN;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -71,9 +71,9 @@ public class PercentTypeConverter extends AbstractTypeConverter<PercentType> {
|
|||
Double number = (type.doubleValue() / 100) * maxValue;
|
||||
|
||||
if (MetadataUtils.isRollerShutter(dp)) {
|
||||
if (type == PercentType.HUNDRED) { // means DOWN
|
||||
if (PercentType.HUNDRED.equals(type)) { // means DOWN
|
||||
return dp.getMinValue().doubleValue();
|
||||
} else if (type == PercentType.ZERO) { // means UP
|
||||
} else if (PercentType.ZERO.equals(type)) { // means UP
|
||||
return maxValue;
|
||||
}
|
||||
return maxValue - number;
|
||||
|
|
|
@ -41,14 +41,14 @@ public class MiscUtils {
|
|||
* Returns true, if the value is not null and true.
|
||||
*/
|
||||
public static boolean isTrueValue(Object value) {
|
||||
return value != null && value == Boolean.TRUE;
|
||||
return Boolean.TRUE.equals(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true, if the value is not null and false.
|
||||
*/
|
||||
public static boolean isFalseValue(Object value) {
|
||||
return value != null && value == Boolean.FALSE;
|
||||
return Boolean.FALSE.equals(value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -175,7 +175,7 @@ public class MetadataUtils {
|
|||
if ("%%".equals(unit)) {
|
||||
return "%d %%";
|
||||
}
|
||||
if (unit != null && unit != "") {
|
||||
if (unit != null && !unit.isEmpty()) {
|
||||
String pattern = getPattern(dp);
|
||||
if (pattern != null) {
|
||||
return String.format("%s %s", pattern, "%unit%");
|
||||
|
|
|
@ -206,7 +206,9 @@ public class IAqualinkHandler extends BaseThingHandler {
|
|||
Optional<Auxiliary> optional = Arrays.stream(auxs).filter(o -> o.getName().equals(channelName))
|
||||
.findFirst();
|
||||
if (optional.isPresent()) {
|
||||
if (toState(channelName, "Switch", optional.get().getState()) != command) {
|
||||
OnOffType onOffCommand = (OnOffType) command;
|
||||
State currentState = toState(channelName, "Switch", optional.get().getState());
|
||||
if (!currentState.equals(onOffCommand)) {
|
||||
client.auxSetCommand(serialNumber, sessionId, channelName);
|
||||
}
|
||||
}
|
||||
|
@ -225,20 +227,23 @@ public class IAqualinkHandler extends BaseThingHandler {
|
|||
}
|
||||
}
|
||||
} else if (command instanceof OnOffType) {
|
||||
OnOffType onOffCommand = (OnOffType) command;
|
||||
// these are toggle commands and require we have the current state to turn on/off
|
||||
if (channelName.startsWith("onetouch_")) {
|
||||
OneTouch[] ota = client.getOneTouch(serialNumber, sessionId);
|
||||
Optional<OneTouch> optional = Arrays.stream(ota).filter(o -> o.getName().equals(channelName))
|
||||
.findFirst();
|
||||
if (optional.isPresent()) {
|
||||
if (toState(channelName, "Switch", optional.get().getState()) != command) {
|
||||
State currentState = toState(channelName, "Switch", optional.get().getState());
|
||||
if (!currentState.equals(onOffCommand)) {
|
||||
logger.debug("Sending command {} to {}", command, channelName);
|
||||
client.oneTouchSetCommand(serialNumber, sessionId, channelName);
|
||||
}
|
||||
}
|
||||
} else if (channelName.endsWith("heater") || channelName.endsWith("pump")) {
|
||||
String value = client.getHome(serialNumber, sessionId).getSerializedMap().get(channelName);
|
||||
if (toState(channelName, "Switch", value) != command) {
|
||||
State currentState = toState(channelName, "Switch", value);
|
||||
if (!currentState.equals(onOffCommand)) {
|
||||
logger.debug("Sending command {} to {}", command, channelName);
|
||||
client.homeScreenSetCommand(serialNumber, sessionId, channelName);
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ public class Device {
|
|||
* @return
|
||||
*/
|
||||
public boolean hasSerialNumber() {
|
||||
return (serialnumber != null && serialnumber != "");
|
||||
return serialnumber != null && !serialnumber.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -731,7 +731,7 @@ public abstract class CommandHandler {
|
|||
int ilevel = dc * intFactor;
|
||||
byte level = (byte) (ilevel > 255 ? 0xFF : ((ilevel < 0) ? 0 : ilevel));
|
||||
String vfield = getStringParameter("value", "");
|
||||
if (vfield == "") {
|
||||
if (vfield == null || vfield.isEmpty()) {
|
||||
logger.warn("{} has no value field specified", nm());
|
||||
}
|
||||
//
|
||||
|
|
|
@ -107,6 +107,7 @@ public abstract class MessageDispatcher {
|
|||
* @param msg
|
||||
* @return true;
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
boolean isMyDirectAck(Msg msg) {
|
||||
return msg.isAckOfDirect() && (feature.getQueryStatus() == DeviceFeature.QueryStatus.QUERY_PENDING)
|
||||
&& feature.getDevice().getFeatureQueried() == feature;
|
||||
|
|
|
@ -359,6 +359,7 @@ public class IpCameraHandler extends BaseThingHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void userEventTriggered(@Nullable ChannelHandlerContext ctx, @Nullable Object evt) throws Exception {
|
||||
if (ctx == null) {
|
||||
return;
|
||||
|
@ -700,6 +701,7 @@ public class IpCameraHandler extends BaseThingHandler {
|
|||
* open large amounts of channels. This may help to keep it under control and WARN the user every 8 seconds this is
|
||||
* still occurring.
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
private void cleanChannels() {
|
||||
for (Channel channel : openChannels) {
|
||||
boolean oldChannel = true;
|
||||
|
|
|
@ -170,7 +170,7 @@ public class JeeLinkHandler extends BaseBridgeHandler implements BridgeHandler,
|
|||
// this is the first handler for this reading class => also setup converter
|
||||
readingClassHandlerMap.put(h.getReadingClass(), handlers);
|
||||
|
||||
if (SensorDefinition.ALL_TYPE == h.getSensorType()) {
|
||||
if (SensorDefinition.ALL_TYPE.equals(h.getSensorType())) {
|
||||
converters.addAll(SensorDefinition.getDiscoveryConverters());
|
||||
} else {
|
||||
JeeLinkReadingConverter<?> c = SensorDefinition.getConverter(h.getSensorType());
|
||||
|
@ -200,7 +200,7 @@ public class JeeLinkHandler extends BaseBridgeHandler implements BridgeHandler,
|
|||
// this was the last handler for this reading class => also remove converter
|
||||
readingClassHandlerMap.remove(h.getReadingClass());
|
||||
|
||||
if (SensorDefinition.ALL_TYPE == h.getSensorType()) {
|
||||
if (SensorDefinition.ALL_TYPE.equals(h.getSensorType())) {
|
||||
converters.removeAll(SensorDefinition.getDiscoveryConverters());
|
||||
} else {
|
||||
JeeLinkReadingConverter<?> c = SensorDefinition.getConverter(h.getSensorType());
|
||||
|
|
|
@ -135,7 +135,7 @@ public class SecondGenerationConfigurationHandler {
|
|||
if (size > 0) {
|
||||
extractSessionId = extractJsonArraySessionId.get(size - 1).getAsJsonObject().get("sessionId").getAsString();
|
||||
}
|
||||
if (extractSessionId == "0") {
|
||||
if ("0".equals(extractSessionId)) {
|
||||
sessionIdLogger.debug(" Login Post Json Reponse not OK! , inverter answered with sessionId like: {}",
|
||||
extractSessionId);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class SecondGenerationConfigurationHandler {
|
|||
if (size > 0) {
|
||||
extractCode = extractJsonArrayCode.get(size - 1).getAsJsonObject().get("code").getAsString();
|
||||
}
|
||||
if (extractCode != "0") {
|
||||
if (!"0".equals(extractCode)) {
|
||||
codeLogger.debug(" Login Post Json Reponse not OK! , inverter answered with status code like: {}",
|
||||
extractCode);
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ public class LcnModuleDiscoveryService extends AbstractDiscoveryService
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
protected void startScan() {
|
||||
synchronized (this) {
|
||||
PckGatewayHandler localBridgeHandler = bridgeHandler;
|
||||
|
|
|
@ -54,6 +54,7 @@ public class LcnModuleRvarSetpointSubHandler extends AbstractLcnModuleVariableSu
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void handleStatusMessage(Matcher matcher) throws LcnException {
|
||||
Variable variable;
|
||||
if (matcher.pattern() == PATTERN) {
|
||||
|
|
|
@ -66,6 +66,7 @@ public class LcnModuleVariableSubHandler extends AbstractLcnModuleVariableSubHan
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void handleStatusMessage(Matcher matcher) throws LcnException {
|
||||
Variable variable;
|
||||
if (matcher.pattern() == PATTERN) {
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*/
|
||||
package org.openhab.binding.lifx.internal.dto;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.lifx.internal.LifxBindingConstants;
|
||||
|
@ -153,7 +155,7 @@ public class Effect {
|
|||
}
|
||||
Effect n = (Effect) o;
|
||||
return n.getType().equals(this.getType()) && n.duration.equals(this.duration) && n.speed.equals(this.speed)
|
||||
&& n.palette == this.palette;
|
||||
&& Arrays.equals(n.palette, this.palette);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -134,14 +134,14 @@ public class ChannelUpdaterJob implements SchedulerRunnable, Runnable {
|
|||
if (unit == null) {
|
||||
return new DecimalType(rawValue);
|
||||
}
|
||||
if (unit == SIUnits.CELSIUS || unit == Units.KELVIN || unit == Units.KILOWATT_HOUR || unit == Units.PERCENT
|
||||
|| unit == Units.HOUR) {
|
||||
if (SIUnits.CELSIUS.equals(unit) || Units.KELVIN.equals(unit) || Units.KILOWATT_HOUR.equals(unit)
|
||||
|| Units.PERCENT.equals(unit) || Units.HOUR.equals(unit)) {
|
||||
return new QuantityType<>((double) rawValue / 10, unit);
|
||||
} else if (unit == Units.HERTZ || unit == Units.SECOND) {
|
||||
} else if (Units.HERTZ.equals(unit) || Units.SECOND.equals(unit)) {
|
||||
return new QuantityType<>((double) rawValue, unit);
|
||||
} else if (unit == Units.LITRE_PER_MINUTE) {
|
||||
} else if (Units.LITRE_PER_MINUTE.equals(unit)) {
|
||||
return new QuantityType<>((double) rawValue / 60, unit);
|
||||
} else if (unit == Units.BAR || unit == Units.VOLT) {
|
||||
} else if (Units.BAR.equals(unit) || Units.VOLT.equals(unit)) {
|
||||
return new QuantityType<>((double) rawValue / 100, unit);
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ public class ChannelUpdaterJob implements SchedulerRunnable, Runnable {
|
|||
var longState = String.format("%s - %s %s - %s", state, getStateTranslation("menuStateLine2", row2),
|
||||
formatHours(time), getStateTranslation("menuStateLine3", row3));
|
||||
|
||||
handleEventType((State) new StringType(longState), HeatpumpChannel.CHANNEL_HEATPUMP_STATUS);
|
||||
handleEventType(new StringType(longState), HeatpumpChannel.CHANNEL_HEATPUMP_STATUS);
|
||||
}
|
||||
|
||||
private void updateProperties(Integer[] heatpumpValues) {
|
||||
|
|
|
@ -854,8 +854,8 @@ public class HeliosEasyControlsHandler extends BaseThingHandler {
|
|||
}
|
||||
switch (itemType) {
|
||||
case "Number":
|
||||
if (((variableType.equals(HeliosVariable.TYPE_INTEGER))
|
||||
|| (variableType == HeliosVariable.TYPE_FLOAT)) && (!value.equals("-"))) {
|
||||
if (((HeliosVariable.TYPE_INTEGER.equals(variableType))
|
||||
|| (HeliosVariable.TYPE_FLOAT.equals(variableType))) && (!value.equals("-"))) {
|
||||
State state = null;
|
||||
if (v.getUnit() == null) {
|
||||
state = DecimalType.valueOf(value);
|
||||
|
|
|
@ -177,7 +177,7 @@ public class Property implements AttributeChanged {
|
|||
Value value;
|
||||
Boolean isDecimal = null;
|
||||
|
||||
if (attributes.name == "") {
|
||||
if (attributes.name.isEmpty()) {
|
||||
attributes.name = propertyID;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ public class SystemBrokerHandler extends AbstractBrokerHandler implements MqttSe
|
|||
* is no connection established yet.
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void brokerAdded(String connectionName, MqttBrokerConnection addedConnection) {
|
||||
if (!connectionName.equals(brokerID) || connection == addedConnection) {
|
||||
return;
|
||||
|
|
|
@ -128,7 +128,7 @@ public class NATherm1Handler extends NetatmoModuleHandler<NAThermostat> {
|
|||
String currentPlanning = "-";
|
||||
if (thermostat.isPresent()) {
|
||||
for (NAThermProgram program : nonNullList(thermostat.get().getThermProgramList())) {
|
||||
if (program.isSelected() == Boolean.TRUE) {
|
||||
if (Boolean.TRUE.equals(program.isSelected())) {
|
||||
currentPlanning = program.getProgramId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public abstract class OceanicThingHandler extends BaseThingHandler {
|
|||
if (aChannel.getUID().equals(theChannelUID)
|
||||
&& selector.getTypeValue() == OceanicChannelSelector.ValueSelectorType.GET) {
|
||||
String response = requestResponse(selector.name());
|
||||
if (response != null && response != "") {
|
||||
if (response != null && !response.isEmpty()) {
|
||||
if (selector.isProperty()) {
|
||||
logger.debug("Updating the property '{}' with value '{}'", selector.toString(),
|
||||
selector.convertValue(response));
|
||||
|
|
|
@ -111,14 +111,14 @@ public class OpenThermGatewayHandler extends BaseThingHandler implements OpenThe
|
|||
if (conn != null && conn.isConnected()) {
|
||||
conn.sendCommand(gatewayCommand);
|
||||
|
||||
if (code == GatewayCommandCode.ControlSetpoint) {
|
||||
if (GatewayCommandCode.ControlSetpoint.equals(code)) {
|
||||
if (gatewayCommand.getMessage().equals("0.0")) {
|
||||
updateState(OpenThermGatewayBindingConstants.CHANNEL_OVERRIDE_CENTRAL_HEATING_WATER_SETPOINT,
|
||||
UnDefType.UNDEF);
|
||||
}
|
||||
updateState(OpenThermGatewayBindingConstants.CHANNEL_OVERRIDE_CENTRAL_HEATING_ENABLED,
|
||||
OnOffType.from(!gatewayCommand.getMessage().equals("0.0")));
|
||||
} else if (code == GatewayCommandCode.ControlSetpoint2) {
|
||||
} else if (GatewayCommandCode.ControlSetpoint2.equals(code)) {
|
||||
if (gatewayCommand.getMessage().equals("0.0")) {
|
||||
updateState(OpenThermGatewayBindingConstants.CHANNEL_OVERRIDE_CENTRAL_HEATING2_WATER_SETPOINT,
|
||||
UnDefType.UNDEF);
|
||||
|
|
|
@ -181,7 +181,7 @@ public class OpenUVReportHandler extends BaseThingHandler {
|
|||
});
|
||||
} else if (ELEVATION.equals(channelUID.getId()) && command instanceof QuantityType) {
|
||||
QuantityType<?> qtty = (QuantityType<?>) command;
|
||||
if (qtty.getUnit() == Units.DEGREE_ANGLE) {
|
||||
if (Units.DEGREE_ANGLE.equals(qtty.getUnit())) {
|
||||
suspendUpdates = qtty.doubleValue() < 0;
|
||||
} else {
|
||||
logger.info("The OpenUV Report handles Sun Elevation of Number:Angle type, {} does not fit.", command);
|
||||
|
|
|
@ -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 + ")";
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -16,6 +16,7 @@ import static org.openhab.binding.pentair.internal.PentairBindingConstants.*;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.openhab.binding.pentair.internal.PentairBindingConstants;
|
||||
import org.openhab.binding.pentair.internal.PentairPacket;
|
||||
|
@ -454,7 +455,7 @@ public class PentairEasyTouchHandler extends PentairBaseThingHandler {
|
|||
}
|
||||
break;
|
||||
case EASYTOUCH_SPAHEATMODESTR:
|
||||
if (phsp == null || (phsp.spaheatmodestr != phspcur.spaheatmodestr)) {
|
||||
if (phsp == null || (!Objects.equals(phsp.spaheatmodestr, phspcur.spaheatmodestr))) {
|
||||
if (phspcur.spaheatmodestr != null) {
|
||||
updateState(channel, new StringType(phspcur.spaheatmodestr));
|
||||
}
|
||||
|
@ -466,7 +467,7 @@ public class PentairEasyTouchHandler extends PentairBaseThingHandler {
|
|||
}
|
||||
break;
|
||||
case EASYTOUCH_POOLHEATMODESTR:
|
||||
if (phsp == null || (phsp.poolheatmodestr != phspcur.poolheatmodestr)) {
|
||||
if (phsp == null || (!Objects.equals(phsp.poolheatmodestr, phspcur.poolheatmodestr))) {
|
||||
if (phspcur.poolheatmodestr != null) {
|
||||
updateState(channel, new StringType(phspcur.poolheatmodestr));
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -177,7 +178,7 @@ public class PLCBridgeHandler extends BaseBridgeHandler {
|
|||
for (Integer key : states.keySet()) {
|
||||
String message = states.get(buffer[0] & key.intValue());
|
||||
synchronized (oldValues) {
|
||||
if ((message != null) && (oldValues.get(channelUID) != message)) {
|
||||
if (message != null && !Objects.equals(oldValues.get(channelUID), message)) {
|
||||
updateState(channelUID, new StringType(message));
|
||||
oldValues.put(channelUID, message);
|
||||
}
|
||||
|
@ -187,7 +188,7 @@ public class PLCBridgeHandler extends BaseBridgeHandler {
|
|||
} else if (DAY_OF_WEEK_CHANNEL.equals(channelId)) {
|
||||
String value = DAY_OF_WEEK.get(Integer.valueOf(buffer[0]));
|
||||
synchronized (oldValues) {
|
||||
if ((value != null) && (oldValues.get(channelUID) != value)) {
|
||||
if (value != null && !Objects.equals(oldValues.get(channelUID), value)) {
|
||||
updateState(channelUID, new StringType(value));
|
||||
oldValues.put(channelUID, value);
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ public abstract class AbstractPlugwiseThingHandler extends BaseThingHandler impl
|
|||
|
||||
protected void updateTask(PlugwiseDeviceTask task) {
|
||||
if (task.shouldBeScheduled()) {
|
||||
if (!task.isScheduled() || task.getConfiguredInterval() != task.getInterval()) {
|
||||
if (!task.isScheduled() || !task.getConfiguredInterval().equals(task.getInterval())) {
|
||||
if (task.isScheduled()) {
|
||||
task.stop();
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ public class PlugwiseStickHandler extends BaseBridgeHandler implements PlugwiseM
|
|||
|
||||
protected void updateTask(PlugwiseDeviceTask task) {
|
||||
if (task.shouldBeScheduled()) {
|
||||
if (!task.isScheduled() || task.getConfiguredInterval() != task.getInterval()) {
|
||||
if (!task.isScheduled() || !task.getConfiguredInterval().equals(task.getInterval())) {
|
||||
if (task.isScheduled()) {
|
||||
task.stop();
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ public class QbusDimmerHandler extends QbusGlobalHandler {
|
|||
}
|
||||
} else if (command instanceof PercentType) {
|
||||
int percentToInt = ((PercentType) command).intValue();
|
||||
if (command == PercentType.ZERO) {
|
||||
if (PercentType.ZERO.equals(command)) {
|
||||
qDimmer.execute(0, snr);
|
||||
} else {
|
||||
qDimmer.execute(percentToInt, snr);
|
||||
|
|
|
@ -218,7 +218,7 @@ public class QbusRolHandler extends QbusGlobalHandler {
|
|||
} else if (command instanceof PercentType) {
|
||||
PercentType p = (PercentType) command;
|
||||
int pp = p.intValue();
|
||||
if (p == PercentType.ZERO) {
|
||||
if (PercentType.ZERO.equals(p)) {
|
||||
qRol.execute(0, snr);
|
||||
} else {
|
||||
qRol.execute(pp, snr);
|
||||
|
@ -264,7 +264,7 @@ public class QbusRolHandler extends QbusGlobalHandler {
|
|||
}
|
||||
} else if (command instanceof PercentType) {
|
||||
int percentToInt = ((PercentType) command).intValue();
|
||||
if (command == PercentType.ZERO) {
|
||||
if (PercentType.ZERO.equals(command)) {
|
||||
qRol.executeSlats(0, snr);
|
||||
} else {
|
||||
qRol.executeSlats(percentToInt, snr);
|
||||
|
|
|
@ -61,6 +61,7 @@ public class SatelOutputHandler extends WirelessChannelsHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
protected StateType getStateType(String channelId) {
|
||||
StateType result = super.getStateType(channelId);
|
||||
if (result == StateType.NONE) {
|
||||
|
|
|
@ -90,6 +90,7 @@ public abstract class SatelStateThingHandler extends SatelThingHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public void incomingEvent(IntegraStateEvent event) {
|
||||
logger.trace("Handling incoming event: {}", event);
|
||||
// update thing's state unless it should accept commands only
|
||||
|
@ -162,6 +163,7 @@ public abstract class SatelStateThingHandler extends SatelThingHandler {
|
|||
* @param event list of state changes since last refresh
|
||||
* @return collection of {@link IntegraStateCommand}
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
protected Collection<SatelCommand> getRefreshCommands(NewStatesEvent event) {
|
||||
final boolean hasExtPayload = getBridgeHandler().getIntegraType().hasExtPayload();
|
||||
final Collection<SatelCommand> result = new LinkedList<>();
|
||||
|
|
|
@ -75,6 +75,7 @@ public class SatelZoneHandler extends WirelessChannelsHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
protected StateType getStateType(String channelId) {
|
||||
StateType result = super.getStateType(channelId);
|
||||
if (result == StateType.NONE) {
|
||||
|
|
|
@ -421,7 +421,7 @@ public class SensiboSkyHandler extends SensiboBaseThingHandler implements Channe
|
|||
case TARGET_TEMPERATURE_PROPERTY:
|
||||
Unit<Temperature> temperatureUnit = sensiboSky.getTemperatureUnit();
|
||||
TemperatureDTO validTemperatures = currentModeCapabilities.temperatures
|
||||
.get(temperatureUnit == SIUnits.CELSIUS ? "C" : "F");
|
||||
.get(SIUnits.CELSIUS.equals(temperatureUnit) ? "C" : "F");
|
||||
DecimalType rawValue = (DecimalType) newPropertyValue;
|
||||
stateChange.updateValue(rawValue.intValue());
|
||||
if (!validTemperatures.validValues.contains(rawValue.intValue())) {
|
||||
|
|
|
@ -2541,6 +2541,7 @@ public class ZonePlayerHandler extends BaseThingHandler implements UpnpIOPartici
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public boolean publicAddress(LineInType lineInType) {
|
||||
// check if sourcePlayer has a line-in connected
|
||||
if ((lineInType != LineInType.DIGITAL && isAnalogLineInConnected())
|
||||
|
|
|
@ -124,7 +124,7 @@ public class ValloxMVHandler extends BaseThingHandler {
|
|||
// Not writable channel
|
||||
return;
|
||||
}
|
||||
if (strUpdateValue != "") {
|
||||
if (!strUpdateValue.isEmpty()) {
|
||||
if (readDataJob != null) {
|
||||
// Re-schedule readDataJob to read device values after data write
|
||||
// Avoid re-scheduling job several times in case of subsequent data writes
|
||||
|
|
|
@ -68,6 +68,7 @@ public class VeluxDiscoveryService extends AbstractDiscoveryService implements R
|
|||
|
||||
// Private
|
||||
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
private void updateLocalization() {
|
||||
if (localization == Localization.UNKNOWN && localeProvider != null && i18nProvider != null) {
|
||||
logger.trace("updateLocalization(): creating Localization based on locale={},translation={}).",
|
||||
|
|
|
@ -125,6 +125,7 @@ public class VeluxHandlerFactory extends BaseThingHandlerFactory {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
private void updateLocalization() {
|
||||
if (localization == Localization.UNKNOWN && localeProvider != null && i18nProvider != null) {
|
||||
logger.trace("updateLocalization(): creating Localization based on locale={},translation={}).",
|
||||
|
|
|
@ -129,6 +129,7 @@ final class ChannelActuatorPosition extends ChannelHandlerTemplate {
|
|||
* information for this channel.
|
||||
* @return newValue ...
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
static @Nullable Command handleCommand(ChannelUID channelUID, String channelId, Command command,
|
||||
VeluxBridgeHandler thisBridgeHandler) {
|
||||
LOGGER.debug("handleCommand({},{},{},{}) called.", channelUID, channelId, command, thisBridgeHandler);
|
||||
|
|
|
@ -107,6 +107,7 @@ final class ChannelVShutterPosition extends ChannelHandlerTemplate {
|
|||
* information for this channel.
|
||||
* @return newValue ...
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
static @Nullable Command handleCommand(ChannelUID channelUID, String channelId, Command command,
|
||||
VeluxBridgeHandler thisBridgeHandler) {
|
||||
LOGGER.debug("handleCommand({},{},{},{}) called.", channelUID, channelId, command, thisBridgeHandler);
|
||||
|
|
|
@ -135,6 +135,7 @@ public class Thing2VeluxActuator {
|
|||
*
|
||||
* @return <b>bridgeProductIndex</B> for accessing the Velux device (or ProductBridgeIndex.UNKNOWN if not found).
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public ProductBridgeIndex getProductBridgeIndex() {
|
||||
if (thisProduct == VeluxProduct.UNKNOWN) {
|
||||
mapThing2Velux();
|
||||
|
@ -151,6 +152,7 @@ public class Thing2VeluxActuator {
|
|||
*
|
||||
* @return <b>isKnown</B> as boolean.
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public boolean isKnown() {
|
||||
return (!(this.getProductBridgeIndex() == ProductBridgeIndex.UNKNOWN));
|
||||
}
|
||||
|
@ -162,6 +164,7 @@ public class Thing2VeluxActuator {
|
|||
*
|
||||
* @return <b>isInverted</B> for handling of values of the Velux device (or false if not found)..
|
||||
*/
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public boolean isInverted() {
|
||||
if (thisProduct == VeluxProduct.UNKNOWN) {
|
||||
mapThing2Velux();
|
||||
|
|
|
@ -159,7 +159,7 @@ public class VentaThingHandler extends BaseThingHandler {
|
|||
if (config.macAddress.isEmpty()) {
|
||||
return "Mac Address not set, use discovery to find the correct one";
|
||||
}
|
||||
if (config.deviceType == BigDecimal.ZERO) {
|
||||
if (BigDecimal.ZERO.equals(config.deviceType)) {
|
||||
return "Device Type not set, use discovery to find the correct one";
|
||||
}
|
||||
if (config.pollingTime.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
|
|
|
@ -318,7 +318,7 @@ public class WLedHandler extends BaseThingHandler {
|
|||
}
|
||||
}
|
||||
} else if (command instanceof HSBType) {
|
||||
if ((((HSBType) command).getBrightness()) == PercentType.ZERO) {
|
||||
if (PercentType.ZERO.equals(((HSBType) command).getBrightness())) {
|
||||
sendGetRequest("/win&TT=500&T=0");
|
||||
}
|
||||
primaryColor = (HSBType) command;
|
||||
|
|
|
@ -87,7 +87,7 @@ public class HueEmulationService implements EventHandler {
|
|||
* Jetty returns 415 on any GET request if a client sends the Content-Type header.
|
||||
* This is a workaround - stripping it away in the preMatching stage.
|
||||
*/
|
||||
if (requestContext.getMethod() == HttpMethod.GET
|
||||
if (HttpMethod.GET.equals(requestContext.getMethod())
|
||||
&& requestContext.getHeaders().containsKey(HttpHeader.CONTENT_TYPE.asString())) {
|
||||
requestContext.getHeaders().remove(HttpHeader.CONTENT_TYPE.asString());
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ package org.openhab.persistence.jdbc.dto;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -140,7 +141,7 @@ public class ItemVO implements Serializable {
|
|||
} else if (!value.equals(other.value)) {
|
||||
return false;
|
||||
}
|
||||
return time == other.time;
|
||||
return Objects.equals(time, other.time);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,7 +82,7 @@ public class MacTTSVoiceTest {
|
|||
*/
|
||||
@Test
|
||||
public void getLocaleTest() throws IOException {
|
||||
assumeTrue("Mac OS X" == System.getProperty("os.name"));
|
||||
assumeTrue("Mac OS X".equals(System.getProperty("os.name")));
|
||||
Process process = Runtime.getRuntime().exec("say -v ?");
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream());
|
||||
BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
|
||||
|
|
|
@ -80,9 +80,9 @@ public final class WWNDataUtil {
|
|||
|
||||
public static String fromFile(String fileName, Unit<Temperature> temperatureUnit) throws IOException {
|
||||
String json = fromFile(fileName);
|
||||
if (temperatureUnit == SIUnits.CELSIUS) {
|
||||
if (SIUnits.CELSIUS.equals(temperatureUnit)) {
|
||||
json = json.replace("\"temperature_scale\": \"F\"", "\"temperature_scale\": \"C\"");
|
||||
} else if (temperatureUnit == ImperialUnits.FAHRENHEIT) {
|
||||
} else if (ImperialUnits.FAHRENHEIT.equals(temperatureUnit)) {
|
||||
json = json.replace("\"temperature_scale\": \"C\"", "\"temperature_scale\": \"F\"");
|
||||
}
|
||||
return json;
|
||||
|
|
Loading…
Reference in New Issue