]> git.basschouten.com Git - openhab-addons.git/commitdiff
Fix SAT warnings (#14214)
authorHolger Friedrich <holgerfriedrich@users.noreply.github.com>
Fri, 13 Jan 2023 18:10:59 +0000 (19:10 +0100)
committerGitHub <noreply@github.com>
Fri, 13 Jan 2023 18:10:59 +0000 (19:10 +0100)
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/Commands.java
bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitBindingConstants.java
bundles/org.openhab.binding.deutschebahn/src/main/java/org/openhab/binding/deutschebahn/internal/timetable/TimetablesV1Impl.java
bundles/org.openhab.binding.deutschebahn/src/test/java/org/openhab/binding/deutschebahn/internal/DeutscheBahnTimetableHandlerTest.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAccessoryFactory.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitMetadataCharacteristicFactory.java
bundles/org.openhab.io.hueemulation/README.md
bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/NetworkUtils.java
bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/CommonSetup.java
bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/UsersAndConfigTests.java

index 2bdc21585bdd4f22f4fd48def37e08d687039638..6b6c033397924aceecc2e644c07d4d5437839b56 100644 (file)
@@ -24,44 +24,44 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 @NonNullByDefault
 public class Commands {
 
-    public static byte[] DISCOVER_SEND = { 0x0c, 0x00, 0x30, 0x00, 0x11, 0x00, 0x12, 0x00, 0x13 };
-    public static byte[] DISCOVER_RECEIVE = { 0x0d, 0x00, 0x07, 0x00, 0x02, 0x02, 0x00 };
-    public static byte[] EMPTY = {};
-    public static byte[] GET_HISTORY = { 0x00, 0x30 };
-    public static byte[] REGISTER_0_READ = { 0x00, 0x04 };
-    public static byte[] REGISTER_1_READ = { 0x01, 0x04 };
-    public static byte[] REGISTER_1_WRITE = { 0x01, 0x06 };
-    public static byte[] REGISTER_2_READ = { 0x02, 0x04 };
-    public static byte[] REGISTER_4_READ = { 0x04, 0x04 };
-    public static byte[] REGISTER_6_READ = { 0x06, 0x04 };
-    public static byte[] MODE = { 0x14, 0x12 };
-    public static byte[] MANUAL_FAN_SPEED_STEP = { 0x15, 0x61 };
-    public static byte[] SUPPLY_FAN_SPEED = { 0x14, 0x50 };
-    public static byte[] EXTRACT_FAN_SPEED = { 0x14, 0x51 };
-    public static byte[] SUPPLY_FAN_STEP = { 0x14, 0x28 };
-    public static byte[] EXTRACT_FAN_STEP = { 0x14, 0x29 };
-    public static byte[] BASE_IN = { 0x14, 0x40 };
-    public static byte[] BASE_OUT = { 0x14, 0x41 };
-    public static byte[] BYPASS = { 0x14, 0x60 };
-    public static byte[] BYPASS_DEACTIVATION = { 0x14, 0x63 };
-    public static byte[] BOOST = { 0x15, 0x30 };
-    public static byte[] NIGHT_COOLING = { 0x15, 0x71 };
-    public static byte[] AUTOMATIC_BYPASS = { 0x17, 0x06 };
-    public static byte[] AUTOMATIC_RUSH_AIRING = { 0x17, 0x02 };
-    public static byte[] HUMIDITY = { 0x14, 0x70 };
-    public static byte[] ROOM_TEMPERATURE = { 0x03, 0x00 };
-    public static byte[] ROOM_TEMPERATURE_CALCULATED = { 0x14, (byte) 0x96 };
-    public static byte[] OUTDOOR_TEMPERATURE = { 0x03, 0x34 };
-    public static byte[] SUPPLY_TEMPERATURE = { 0x14, 0x73 };
-    public static byte[] EXTRACT_TEMPERATURE = { 0x14, 0x74 };
-    public static byte[] EXHAUST_TEMPERATURE = { 0x14, 0x75 };
-    public static byte[] BATTERY_LIFE = { 0x03, 0x0f };
-    public static byte[] FILTER_LIFE = { 0x14, 0x6a };
-    public static byte[] FILTER_PERIOD = { 0x14, 0x69 };
-    public static byte[] CURRENT_TIME = { 0x15, (byte) 0xe0 };
-    public static byte[] AWAY_TO = { 0x15, 0x20 };
-    public static byte[] AWAY_FROM = { 0x15, 0x21 };
-    public static byte[] UNIT_SERIAL = { 0x00, 0x25 }; // endpoint 4
-    public static byte[] UNIT_NAME = { 0x15, (byte) 0xe5 }; // endpoint 1
-    public static byte[] CCM_SERIAL = { 0x14, 0x6a }; // endpoint 0
+    public static final byte[] DISCOVER_SEND = { 0x0c, 0x00, 0x30, 0x00, 0x11, 0x00, 0x12, 0x00, 0x13 };
+    public static final byte[] DISCOVER_RECEIVE = { 0x0d, 0x00, 0x07, 0x00, 0x02, 0x02, 0x00 };
+    public static final byte[] EMPTY = {};
+    public static final byte[] GET_HISTORY = { 0x00, 0x30 };
+    public static final byte[] REGISTER_0_READ = { 0x00, 0x04 };
+    public static final byte[] REGISTER_1_READ = { 0x01, 0x04 };
+    public static final byte[] REGISTER_1_WRITE = { 0x01, 0x06 };
+    public static final byte[] REGISTER_2_READ = { 0x02, 0x04 };
+    public static final byte[] REGISTER_4_READ = { 0x04, 0x04 };
+    public static final byte[] REGISTER_6_READ = { 0x06, 0x04 };
+    public static final byte[] MODE = { 0x14, 0x12 };
+    public static final byte[] MANUAL_FAN_SPEED_STEP = { 0x15, 0x61 };
+    public static final byte[] SUPPLY_FAN_SPEED = { 0x14, 0x50 };
+    public static final byte[] EXTRACT_FAN_SPEED = { 0x14, 0x51 };
+    public static final byte[] SUPPLY_FAN_STEP = { 0x14, 0x28 };
+    public static final byte[] EXTRACT_FAN_STEP = { 0x14, 0x29 };
+    public static final byte[] BASE_IN = { 0x14, 0x40 };
+    public static final byte[] BASE_OUT = { 0x14, 0x41 };
+    public static final byte[] BYPASS = { 0x14, 0x60 };
+    public static final byte[] BYPASS_DEACTIVATION = { 0x14, 0x63 };
+    public static final byte[] BOOST = { 0x15, 0x30 };
+    public static final byte[] NIGHT_COOLING = { 0x15, 0x71 };
+    public static final byte[] AUTOMATIC_BYPASS = { 0x17, 0x06 };
+    public static final byte[] AUTOMATIC_RUSH_AIRING = { 0x17, 0x02 };
+    public static final byte[] HUMIDITY = { 0x14, 0x70 };
+    public static final byte[] ROOM_TEMPERATURE = { 0x03, 0x00 };
+    public static final byte[] ROOM_TEMPERATURE_CALCULATED = { 0x14, (byte) 0x96 };
+    public static final byte[] OUTDOOR_TEMPERATURE = { 0x03, 0x34 };
+    public static final byte[] SUPPLY_TEMPERATURE = { 0x14, 0x73 };
+    public static final byte[] EXTRACT_TEMPERATURE = { 0x14, 0x74 };
+    public static final byte[] EXHAUST_TEMPERATURE = { 0x14, 0x75 };
+    public static final byte[] BATTERY_LIFE = { 0x03, 0x0f };
+    public static final byte[] FILTER_LIFE = { 0x14, 0x6a };
+    public static final byte[] FILTER_PERIOD = { 0x14, 0x69 };
+    public static final byte[] CURRENT_TIME = { 0x15, (byte) 0xe0 };
+    public static final byte[] AWAY_TO = { 0x15, 0x20 };
+    public static final byte[] AWAY_FROM = { 0x15, 0x21 };
+    public static final byte[] UNIT_SERIAL = { 0x00, 0x25 }; // endpoint 4
+    public static final byte[] UNIT_NAME = { 0x15, (byte) 0xe5 }; // endpoint 1
+    public static final byte[] CCM_SERIAL = { 0x14, 0x6a }; // endpoint 0
 }
index 84d20fbed4426b1387c0f6d48dc730b98877bc1d..535c8130de46017931bc4592f6144569f6e09caa 100644 (file)
@@ -28,11 +28,11 @@ import org.openhab.core.thing.ThingTypeUID;
 @NonNullByDefault
 public class DanfossAirUnitBindingConstants {
 
-    public static String BINDING_ID = "danfossairunit";
+    public static final String BINDING_ID = "danfossairunit";
 
     // The only thing type UIDs
-    public static ThingTypeUID THING_TYPE_AIRUNIT = new ThingTypeUID(BINDING_ID, "airunit");
+    public static final ThingTypeUID THING_TYPE_AIRUNIT = new ThingTypeUID(BINDING_ID, "airunit");
 
     // The thing type as a set
-    public static Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_AIRUNIT);
+    public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_AIRUNIT);
 }
index 4946d24c8864039307fd0639013f28c5001e4965..475bf0168b59a4bc983ae2ced8002a3b54f5b2b3 100644 (file)
@@ -193,6 +193,7 @@ public final class TimetablesV1Impl implements TimetablesV1Api {
     /**
      * Build rest endpoint URL for request the planned timetable.
      */
+    @SuppressWarnings("PMD.UnsynchronizedStaticFormatter")
     private String buildPlanRequestURL(final String evaNr, final Date date) {
         synchronized (this) {
             final String dateParam = DATE_FORMAT.format(date);
index 8e87d391b47652fc1c70b86c73504f31e098b263..87b975f1fea0a9be648b36421bd77b47043a0599 100644 (file)
@@ -186,7 +186,6 @@ public class DeutscheBahnTimetableHandlerTest implements TimetablesV1ImplTestHel
             verifyChannelsUpdatedToUndef(bridge, 0, callback);
             verifyChannelsUpdatedToUndef(bridge, 1, callback);
             verifyChannelsUpdatedToUndef(bridge, 2, callback);
-
         } finally {
             handler.dispose();
         }
@@ -226,7 +225,6 @@ public class DeutscheBahnTimetableHandlerTest implements TimetablesV1ImplTestHel
             verifyThingUpdated(bridge, 0, stop01.getId());
             verifyChannelsUpdatedToUndef(bridge, 1, callback);
             verifyChannelsUpdatedToUndef(bridge, 2, callback);
-
         } finally {
             handler.dispose();
         }
index d8a20b5352578f05c0c83ec78fd26d4bc1acfcd4..a3c15b48173f223a59a939b5a52444452bafd25d 100644 (file)
@@ -413,8 +413,9 @@ public class HomekitAccessoryFactory {
                 .collect(Collectors.toList())) {
             var characteristic = HomekitMetadataCharacteristicFactory.createCharacteristic(entry.getKey(),
                     entry.getValue());
-            if (characteristic.isPresent())
+            if (characteristic.isPresent()) {
                 accessory.addCharacteristic(characteristic.get());
+            }
         }
     }
 
index 5c0c88bfc0c1791df09ed9e311f74d0e16755416..0458a9bacb142cbf7f73f9d351fa91f265c83698 100644 (file)
@@ -72,7 +72,7 @@ public class HomekitMetadataCharacteristicFactory {
     private static final Logger logger = LoggerFactory.getLogger(HomekitMetadataCharacteristicFactory.class);
 
     // List of optional characteristics that can be set via metadata, and the corresponding method to create them.
-    private final static Map<HomekitCharacteristicType, Function<Object, Characteristic>> optional = new HashMap<>() {
+    private static final Map<HomekitCharacteristicType, Function<Object, Characteristic>> optional = new HashMap<>() {
         {
             put(ACTIVE_IDENTIFIER, HomekitMetadataCharacteristicFactory::createActiveIdentifierCharacteristic);
             put(ACTIVE_STATUS, HomekitMetadataCharacteristicFactory::createActiveStatusCharacteristic);
@@ -101,8 +101,9 @@ public class HomekitMetadataCharacteristicFactory {
 
     public static Optional<Characteristic> createCharacteristic(String characteristic, Object value) {
         var type = HomekitCharacteristicType.valueOfTag(characteristic);
-        if (type.isEmpty() || !optional.containsKey(type.get()))
+        if (type.isEmpty() || !optional.containsKey(type.get())) {
             return Optional.empty();
+        }
         return Optional.of(optional.get(type.get()).apply(value));
     }
 
index 56e4c53b69d8f91f6a79adda7990a324cbc699dc..c9c068c0847838fc05fc990d76d7507f190d3e97 100644 (file)
@@ -155,6 +155,7 @@ You must either
 * port forward your openHAB installation to port 80,
   (`iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080`)
 * install a reverse proxy on port 80, for example nginx with the following configuration:
+
   ```
   server {
     listen 80;
@@ -167,10 +168,12 @@ You must either
     }
   }
   ```
+
 * or let openHAB run on port 80 (the entire java process requires elevated privileges).
 
 * For Amazon Echo the pairing process may fail due to a 302 response from openHAB, this can be resolved by using a reverse proxy to change the request url from `/api` to `/api/`, for example nginx with the following configuration:
-```
+
+  ```
   server {
     listen 80;
     location /api {
@@ -178,6 +181,7 @@ You must either
     }
   }
   ```
+
 Please open port 80 tcp and port 1900 udp in your firewall installation.
 
 You can test if the hue emulation does its job by enabling pairing mode including the option "Amazon Echo device discovery fix".
index af2328f544bbc13e69fdfcf98ae971c6943dc42b..f2c42fcd2c6f9ba6cc66f72d5e15225cc0f6f954 100644 (file)
@@ -74,7 +74,7 @@ public class NetworkUtils {
     /**
      * Adds cors headers to the given response and returns it.
      */
-    public static ResponseBuilder ResponseWithCors(ResponseBuilder response) {
+    public static ResponseBuilder responseWithCors(ResponseBuilder response) {
         return response.encoding(StandardCharsets.UTF_8.name()) //
                 .header("Access-Control-Allow-Origin", "*")
                 .header("Access-Control-Allow-Headers", "origin, content-type, accept, authorization")
index 55dd9d316816799f4f7b268d3cea99d14ffa563b..58a47cb098488f20d5e281b0933a5bcc573427cd 100644 (file)
@@ -95,7 +95,7 @@ public class CommonSetup {
         @SuppressWarnings("unchecked")
         @Override
         public <T> Storage<T> getStorage(String name) {
-            if (name.equals("hueEmulationUsers")) {
+            if ("hueEmulationUsers".equals(name)) {
                 return (Storage<T>) new DummyUsersStorage();
             }
             throw new IllegalStateException();
index 961af881243a32b5043c75bfb10b3091e5d1715e..d015e3effcb699b2025296ae9669344ff3107cc5 100644 (file)
@@ -122,7 +122,7 @@ public class UsersAndConfigTests {
     }
 
     @Test
-    public void UnauthorizedAccessTest() {
+    public void unauthorizedAccessTest() {
         // Unauthorized config
         Response response;
         response = commonSetup.client.target(commonSetup.basePath + "/config").request().get();