]> git.basschouten.com Git - openhab-addons.git/commitdiff
[lifx] Fix all code analysis findings (#13638)
authorlolodomo <lg.hc@free.fr>
Tue, 1 Nov 2022 14:31:37 +0000 (15:31 +0100)
committerGitHub <noreply@github.com>
Tue, 1 Nov 2022 14:31:37 +0000 (15:31 +0100)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/HevCycleState.java
bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/dto/Packet.java
bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/HSBK.java
bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/fields/MACAddress.java
bundles/org.openhab.binding.lifx/src/main/java/org/openhab/binding/lifx/internal/util/LifxThrottlingUtil.java

index 4139dd027ddf93388cb66d16d506c6870a7adc6b..02acc152595144bec9552d32249ed988c3b5b672 100644 (file)
@@ -73,10 +73,7 @@ public class HevCycleState {
         } else if (!duration.equals(other.duration)) {
             return false;
         }
-        if (enable != other.enable) {
-            return false;
-        }
-        return true;
+        return enable == other.enable;
     }
 
     @Override
index a8cd4307e7637374e743b52fdb4f96fc01fe840d..bf78f0b426d52736d72e21f421218b99ac181887 100644 (file)
@@ -389,9 +389,6 @@ public abstract class Packet {
     }
 
     public boolean isFulfilled(Packet somePacket) {
-        if (isExpectedResponse(somePacket.getPacketType())) {
-            return true;
-        }
-        return false;
+        return isExpectedResponse(somePacket.getPacketType());
     }
 }
index 9a6c24246b4b43cd35b9342d7e8a870de484c26d..0a3d081c1aeede9004db6270ac74ec728d8f0bf3 100644 (file)
@@ -126,10 +126,7 @@ public class HSBK {
         if (brightness != other.brightness) {
             return false;
         }
-        if (kelvin != other.kelvin) {
-            return false;
-        }
-        return true;
+        return kelvin == other.kelvin;
     }
 
     @Override
index a5ad018037edc495aea101634284b52cab9f5513..312fb40ffe042092b1b2b600acbda066597c2d61 100644 (file)
@@ -101,10 +101,6 @@ public class MACAddress {
         }
 
         final MACAddress other = (MACAddress) obj;
-        if (!this.hex.equalsIgnoreCase(other.hex)) {
-            return false;
-        }
-
-        return true;
+        return this.hex.equalsIgnoreCase(other.hex);
     }
 }
index b55d81c1be8f32b81bd0de4669559dae8a98fefd..248f74be64ba1bbde0ac5186c0fa514428a679c2 100644 (file)
@@ -23,8 +23,6 @@ import java.util.concurrent.locks.ReentrantLock;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.binding.lifx.internal.fields.MACAddress;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * The {@link LifxThrottlingUtil} is a utility class that regulates the frequency at which messages/packets are
@@ -37,8 +35,6 @@ import org.slf4j.LoggerFactory;
 @NonNullByDefault
 public final class LifxThrottlingUtil {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(LifxThrottlingUtil.class);
-
     private LifxThrottlingUtil() {
         // hidden utility class constructor
     }