]> git.basschouten.com Git - openhab-addons.git/commitdiff
[velux] eliminate mvn compiler warnings (#8606)
authorAndrew Fiddian-Green <software@whitebear.ch>
Tue, 29 Sep 2020 17:21:44 +0000 (18:21 +0100)
committerGitHub <noreply@github.com>
Tue, 29 Sep 2020 17:21:44 +0000 (10:21 -0700)
* [velux] remove redundant NonNullByDefault annotations

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
30 files changed:
bundles/org.openhab.binding.velux/README.md
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/VeluxBinding.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/VeluxBridgeActuators.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/VeluxBridgeDeviceStatus.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/VeluxBridgeGetFirmware.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/VeluxBridgeLANConfig.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/VeluxBridgeScenes.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/VeluxBridgeWLANConfig.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCgetDeviceStatus.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCgetFirmware.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCgetLANConfig.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCgetProducts.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCgetScenes.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCgetWLANConfig.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JClogin.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JClogout.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCrunProductDiscovery.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCrunProductIdentification.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCrunProductSearch.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCrunScene.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JCsetSceneVelocity.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/json/JsonVeluxBridge.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/bridge/slip/utils/SlipEncoding.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/factory/VeluxHandlerFactory.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/handler/VeluxBridgeHandler.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/things/VeluxKLFAPI.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/things/VeluxProduct.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/things/VeluxProductState.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/things/VeluxScene.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/utils/Localization.java

index df277da3c806e405da9a3e86d7ab656bd2fc9ec6..a5d7dd3566634c6ed8f1e56091223ef9a9d7f41a 100644 (file)
@@ -197,7 +197,7 @@ The bridge Thing provides the following properties.
 | products          | List of all recognized products                                 |
 | scenes            | List of all defined scenes                                      |
 | subnetMask        | IP subnetmask of the Bridge                                     |
-| vendor            | Vendow name                                                     |
+| vendor            | Vendor name                                                     |
 | WLANSSID          | Name of the wireless network (not suported any more)            |
 | WLANPassword      | WLAN Authentication Password (not suported any more)            |
 
index c213dffc2b6f0bdf9a85a2174028da61847f33e6..b483c9ff8fd13eab5cdf0e502ade846ee7c0410d 100644 (file)
@@ -16,7 +16,6 @@ import static org.apache.commons.lang.StringUtils.isNotBlank;
 
 import java.lang.reflect.Field;
 
-import org.apache.commons.lang.StringUtils;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.binding.velux.internal.config.VeluxBridgeConfiguration;
@@ -56,8 +55,9 @@ public class VeluxBinding extends VeluxBridgeConfiguration {
         logger.trace("VeluxBinding(constructor) called.");
         if (logger.isTraceEnabled()) {
             for (Field field : VeluxBridgeConfiguration.class.getFields()) {
-                if (!StringUtils.capitalize(field.getName()).contentEquals(field.getName())) {
-                    logger.trace("VeluxBinding(): FYI: a potential configuration string is '{}'.", field.getName());
+                String fName = field.getName();
+                if ((fName.length() > 0) && Character.isUpperCase(fName.charAt(0))) {
+                    logger.trace("VeluxBinding(): FYI: a potential configuration string is '{}'.", fName);
                 }
             }
         }
index b09ddbf56844ea8248fb3a7ef3576ddfecec9fa2..e77d39c2c8982f1a9ea20a469e19dc34fbdf7301 100644 (file)
@@ -64,7 +64,6 @@ public class VeluxBridgeActuators {
      * <li>existingProducts ({@link VeluxExistingProducts}).
      * </ul>
      */
-    @NonNullByDefault
     public class Channel {
         public VeluxExistingProducts existingProducts = new VeluxExistingProducts();
     }
index 8c1cdab419dda4c8fb9736d1e9a99aef1d1f9309..fd91b77fc912cb1715d73df9b6ecff1e310129fe 100644 (file)
@@ -48,7 +48,6 @@ public class VeluxBridgeDeviceStatus {
      * <li>{@link #gwStateDescription} containing the verbose gateway state.
      * </ul>
      */
-    @NonNullByDefault
     public class Channel {
         public boolean isRetrieved = false;
         public StringType gwState = new StringType(VeluxBindingConstants.UNKNOWN);
index f4971ca1c5395153609c3fb2178548aac7619433..3432185ff99042160f3cf6b240ed947c922c1c0f 100644 (file)
@@ -46,7 +46,6 @@ public class VeluxBridgeGetFirmware {
      * <li>firmwareVersion (human readable String).
      * </ul>
      */
-    @NonNullByDefault
     public class Channel {
         public boolean isRetrieved = false;
         public StringType firmwareVersion = new StringType(VeluxBindingConstants.UNKNOWN);
index f78921ff6b6b2d9e89f6d54a18ec94f2014f0f2f..30086f6a1d7f732045752a923135a244a176779f 100644 (file)
@@ -50,7 +50,6 @@ public class VeluxBridgeLANConfig {
      * <li>enabledDHCP.
      * </ul>
      */
-    @NonNullByDefault
     public class Channel {
         public boolean isRetrieved = false;
         public StringType openHABipAddress = new StringType(VeluxBindingConstants.UNKNOWN);
index ae82277c197287cdb08a1f7f9e39e0be5abdccb0..58f075e5045c3cb83c478c33f8427c0108e724ab 100644 (file)
@@ -49,7 +49,6 @@ public class VeluxBridgeScenes {
      * <li>existingScenes ({@link VeluxExistingScenes}).
      * </ul>
      */
-    @NonNullByDefault
     public class Channel {
         public VeluxExistingScenes existingScenes = new VeluxExistingScenes();
     }
index 4ab622b54237e8e2dee0d5aed51260309de7a500..06ef755200bdc5886805da337b5719a014e7164c 100644 (file)
@@ -48,7 +48,6 @@ public class VeluxBridgeWLANConfig {
      * <li>wlanPassword.
      * </ul>
      */
-    @NonNullByDefault
     public class Channel {
         public boolean isRetrieved = false;
         public StringType openHABwlanSSID = new StringType(VeluxBindingConstants.UNKNOWN);
index 77e3d668c405df603170c0e9d566966d3c595d5f..56c81fa3462977d2b9f163e2b81ce39b3e12ab25 100644 (file)
@@ -62,7 +62,6 @@ class JCgetDeviceStatus extends GetDeviceStatus implements JsonBridgeCommunicati
      * NOTE: the gateway software is extremely sensitive to this exact JSON structure.
      * Any modifications (like omitting empty params) will lead to an gateway error.
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -93,7 +92,6 @@ class JCgetDeviceStatus extends GetDeviceStatus implements JsonBridgeCommunicati
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index 76b52c0026962fc0ab07f036dd060e55762208f4..e58afd05ac107a67bd87ae50793cd84f4f18b304 100644 (file)
@@ -56,7 +56,6 @@ class JCgetFirmware extends GetFirmware implements JsonBridgeCommunicationProtoc
      * {"action":"getFirmware","params":{}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -76,7 +75,6 @@ class JCgetFirmware extends GetFirmware implements JsonBridgeCommunicationProtoc
      * <P>
      * Used within structure {@link JCgetFirmware} to describe the software of the Bridge.
      */
-    @NonNullByDefault
     private static class BCfirmwareVersion {
         /*
          * "version": "0.1.1.0.41.0"
@@ -100,7 +98,6 @@ class JCgetFirmware extends GetFirmware implements JsonBridgeCommunicationProtoc
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index 14165afb473ed6c9215dd71ed1a0b97f6ba7230d..1b1537daac943950c5114e201dce78e6770ad538 100644 (file)
@@ -57,7 +57,6 @@ class JCgetLANConfig extends GetLANConfig implements BridgeCommunicationProtocol
      * {"action":"get","params":{}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -81,7 +80,6 @@ class JCgetLANConfig extends GetLANConfig implements BridgeCommunicationProtocol
      * {"ipAddress":"192.168.45.9","subnetMask":"255.255.255.0","defaultGateway":"192.168.45.129","dhcp":false}
      * </pre>
      */
-    @NonNullByDefault
     private static class BCLANConfig {
         private String ipAddress = VeluxBindingConstants.UNKNOWN;
         private String subnetMask = VeluxBindingConstants.UNKNOWN;
@@ -111,7 +109,6 @@ class JCgetLANConfig extends GetLANConfig implements BridgeCommunicationProtocol
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index b70c6566f608f47f667aa3304a5d7746c81c4ca2..64bba1bbd3496b275637a490b40e8af1915a9db2 100644 (file)
@@ -61,7 +61,6 @@ class JCgetProducts extends GetProducts implements JsonBridgeCommunicationProtoc
      * ]
      * </PRE>
      */
-    @NonNullByDefault
     private class BCproduct {
         private String name = VeluxBindingConstants.UNKNOWN;
         @SuppressWarnings("unused")
@@ -84,7 +83,6 @@ class JCgetProducts extends GetProducts implements JsonBridgeCommunicationProtoc
      * {"action":"get","params":{}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -126,7 +124,6 @@ class JCgetProducts extends GetProducts implements JsonBridgeCommunicationProtoc
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index 284a28579d4ad964dfeb6dc6955b66fdfc184ebe..e3dedd392bb174259bbd5eeacbefa5c0d4378021 100644 (file)
@@ -59,7 +59,6 @@ class JCgetScenes extends GetScenes implements JsonBridgeCommunicationProtocol {
      * "status": 0
      * </PRE>
      */
-    @NonNullByDefault
     private static class BCproductState {
         private int typeId;
         private String name = VeluxBindingConstants.UNKNOWN;
@@ -91,7 +90,6 @@ class JCgetScenes extends GetScenes implements JsonBridgeCommunicationProtocol {
      * },
      * </PRE>
      */
-    @NonNullByDefault
     private static class BCscene {
         private String name = VeluxBindingConstants.UNKNOWN;
         private int id;
@@ -110,7 +108,6 @@ class JCgetScenes extends GetScenes implements JsonBridgeCommunicationProtocol {
      * {"action":"get","params":{}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -150,7 +147,6 @@ class JCgetScenes extends GetScenes implements JsonBridgeCommunicationProtocol {
      * }
      * </PRE>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index 0831033dbf646e56f1debda1b9ef9a7bd397ee84..50a36b51ed24b4a30711762de12def00d32e3593 100644 (file)
@@ -57,7 +57,6 @@ class JCgetWLANConfig extends GetWLANConfig implements JsonBridgeCommunicationPr
      * {"action":"wifi","params":{}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -81,7 +80,6 @@ class JCgetWLANConfig extends GetWLANConfig implements JsonBridgeCommunicationPr
      * {"password":"Esf56mxqFY","name":"VELUX_KLF_847C"}
      * </PRE>
      */
-    @NonNullByDefault
     private static class BCWLANConfig {
 
         private String password = VeluxBindingConstants.UNKNOWN;
@@ -110,7 +108,6 @@ class JCgetWLANConfig extends GetWLANConfig implements JsonBridgeCommunicationPr
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index 3e8880dc047af8a2cfe4a9ad00c00813c719ea9c..2cbf552d3641ad4eac16aa5357b006c97baf255e 100644 (file)
@@ -45,7 +45,6 @@ class JClogin extends Login implements JsonBridgeCommunicationProtocol {
     /*
      * Message Objects
      */
-    @NonNullByDefault
     private static class ParamsLogin {
         @SuppressWarnings("unused")
         private String password = VeluxBindingConstants.UNKNOWN;
@@ -61,7 +60,6 @@ class JClogin extends Login implements JsonBridgeCommunicationProtocol {
      * {"action":"login","params":{"password":"PASSWORD"}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -83,7 +81,6 @@ class JClogin extends Login implements JsonBridgeCommunicationProtocol {
      * '{"token": "PHPnfLda71xfGlxoYEOTGQ==", "result": true, "deviceStatus": "IDLE", "data": {}, "errors": [] }'
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         private String token = VeluxBindingConstants.UNKNOWN;
         private boolean result;
index 62f788d2108d493716114c1407358e0538cfa539..57a04cd875ac9878560057c49a684fb5a6ff70ec 100644 (file)
@@ -51,7 +51,6 @@ class JClogout extends Logout implements JsonBridgeCommunicationProtocol {
      * {"action":"logout","params":{}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -75,7 +74,6 @@ class JClogout extends Logout implements JsonBridgeCommunicationProtocol {
      * '{"token": "PHPnfLda71xfGlxoYEOTGQ==", "result": true, "deviceStatus": "IDLE", "data": {}, "errors": [] }'
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index 4f01d18c631788c28516c4df6e7742819b0bd309..1d5ddcbf65c1df8a561e2462b733909831b3f5af 100644 (file)
@@ -58,7 +58,6 @@ class JCrunProductDiscovery extends RunProductDiscovery implements JsonBridgeCom
      * NOTE: the gateway software is extremely sensitive to this exact JSON structure.
      * Any modifications (like omitting empty params) will lead to an gateway error.
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -89,7 +88,6 @@ class JCrunProductDiscovery extends RunProductDiscovery implements JsonBridgeCom
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index a70b9227d699b7b3cb8c20a62d82f982737b117b..0f0e2c17c97ce477c2344d16d4c445312c1f45a0 100644 (file)
@@ -46,7 +46,6 @@ class JCrunProductIdentification extends RunProductIdentification implements Jso
     /*
      * Message Objects
      */
-    @NonNullByDefault
     private static class ParamsIdentifyProduct {
         @SuppressWarnings("unused")
         private int id;
@@ -68,7 +67,6 @@ class JCrunProductIdentification extends RunProductIdentification implements Jso
      * {"action":"identify","params":{"id":23,"time":254}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
         @SuppressWarnings("unused")
         private String action;
@@ -98,7 +96,6 @@ class JCrunProductIdentification extends RunProductIdentification implements Jso
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index df42711c8aa71895dffd4a19e4b2f1211d19e32a..01c809712f1abb09675628ee97a7b5e487739d1e 100644 (file)
@@ -60,7 +60,6 @@ class JCrunProductSearch extends RunProductSearch implements JsonBridgeCommunica
      * NOTE: the gateway software is extremely sensitive to this exact JSON structure.
      * Any modifications (like omitting empty params) will lead to an gateway error.
      */
-    @NonNullByDefault
     private static class Request {
 
         @SuppressWarnings("unused")
@@ -91,7 +90,6 @@ class JCrunProductSearch extends RunProductSearch implements JsonBridgeCommunica
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index bc4475599022678e47087ca2aabb920a79e778ae..9f94a326798d0a8d6b22486ea4192d9b8ae6424e 100644 (file)
@@ -42,7 +42,6 @@ class JCrunScene extends RunScene implements JsonBridgeCommunicationProtocol {
     /*
      * Message Objects
      */
-    @NonNullByDefault
     private static class ParamsRunScene {
         @SuppressWarnings("unused")
         private int id;
@@ -58,7 +57,6 @@ class JCrunScene extends RunScene implements JsonBridgeCommunicationProtocol {
      * {"action":"run","params":{"id":9}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
         @SuppressWarnings("unused")
         private String action;
@@ -86,7 +84,6 @@ class JCrunScene extends RunScene implements JsonBridgeCommunicationProtocol {
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index 6b5073b11bfcef0dc60ad036833981654ecac011..e96f30f2d561eaf4b30389050f07ccdb407dbfd7 100644 (file)
@@ -45,7 +45,6 @@ class JCsetSceneVelocity extends SetSceneVelocity implements JsonBridgeCommunica
     /*
      * Message Objects
      */
-    @NonNullByDefault
     private static class ParamsRunScene {
         @SuppressWarnings("unused")
         private int id;
@@ -68,7 +67,6 @@ class JCsetSceneVelocity extends SetSceneVelocity implements JsonBridgeCommunica
      * {"action":"setSilentMode","params":{"id":9,"silent":false}}}
      * </pre>
      */
-    @NonNullByDefault
     private static class Request {
         @SuppressWarnings("unused")
         private String action;
@@ -97,7 +95,6 @@ class JCsetSceneVelocity extends SetSceneVelocity implements JsonBridgeCommunica
      * }
      * </pre>
      */
-    @NonNullByDefault
     private static class Response {
         @SuppressWarnings("unused")
         private String token = VeluxBindingConstants.UNKNOWN;
index 17f937112d75434298075dc0d38e3af19b82b26c..b5092e1a8e06aa0186e7bcfd778eca3fb057c55b 100644 (file)
  */
 package org.openhab.binding.velux.internal.bridge.json;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 import java.util.Properties;
 import java.util.TreeSet;
 
-import org.apache.commons.io.IOUtils;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.openhab.binding.velux.internal.bridge.VeluxBridge;
 import org.openhab.binding.velux.internal.bridge.VeluxBridgeInstance;
@@ -185,6 +185,9 @@ public class JsonVeluxBridge extends VeluxBridge {
             } else {
                 response = ioUnauthenticated(sapURL, getRequest, classOfResponse);
             }
+            if (response == null) {
+                throw new IOException("Failed to create 'response' object");
+            }
             communication.setResponse(response);
             logger.trace("bridgeCommunicate(): communication result is {}, returning details.",
                     communication.isCommunicationSuccessful());
@@ -233,7 +236,7 @@ public class JsonVeluxBridge extends VeluxBridge {
                 if (authentication.length() > 0) {
                     headerItems.setProperty("Authorization", String.format("Bearer %s", authentication));
                 }
-                InputStream content = IOUtils.toInputStream(jsonRequest, StandardCharsets.UTF_8.name());
+                InputStream content = new ByteArrayInputStream(jsonRequest.getBytes(StandardCharsets.UTF_8));
 
                 String jsonResponse = HttpUtil.executeUrl("PUT", url, headerItems, content, "application/json",
                         this.bridgeInstance.veluxBridgeConfiguration().timeoutMsecs);
@@ -253,7 +256,6 @@ public class JsonVeluxBridge extends VeluxBridge {
                 T response = gson.fromJson(jsonResponse, classOfResponse);
                 lastCommunicationInMSecs = lastSuccessfulCommunicationInMSecs = System.currentTimeMillis();
                 return response;
-
             } catch (IOException ioe) {
                 logger.trace("io(): Exception occurred during I/O: {}.", ioe.getMessage());
                 // Error Retries with Exponential Backoff
@@ -269,7 +271,6 @@ public class JsonVeluxBridge extends VeluxBridge {
                 logger.info("io(): Exception occurred on deserialization: {}, aborting.", jse.getMessage());
                 throw jse;
             }
-
         } while (retryCount++ < this.bridgeInstance.veluxBridgeConfiguration().retries);
         throw new IOException(String.format("io(): socket I/O failed (%d times).",
                 this.bridgeInstance.veluxBridgeConfiguration().retries));
index 3c4e7406459d3e9b8bc9d95f86eb488052e45aa5..2af5030b75dd22f2bbb09ea5446e8b0a2c4282c1 100644 (file)
@@ -58,7 +58,7 @@ public class SlipEncoding {
      */
     public SlipEncoding(short command, byte[] data) {
         logger.trace("SlipEncoding(constructor) for command 0x{} with data size {} called.",
-                Integer.toHexString(new Short(command).intValue()), data.length);
+                Integer.toHexString(Short.valueOf(command).intValue()), data.length);
         if (data.length > 250) {
             logger.warn("SlipEncoding(constructor) called with data size {}: too big, aborting.", data.length);
             encodingValid = false;
index 52710a7912555885869c46bd99000b38938bb4ff..41b8708c44fe9965f6a98d342f7b65654ae789a6 100644 (file)
@@ -68,9 +68,11 @@ public class VeluxHandlerFactory extends BaseThingHandlerFactory {
 
     private void registerDeviceDiscoveryService(VeluxBridgeHandler bridgeHandler) {
         logger.trace("registerDeviceDiscoveryService({}) called.", bridgeHandler);
-        boolean createNew = (discoveryService == null);
-        if (createNew) {
+        boolean createNew = false;
+        VeluxDiscoveryService discoveryService = this.discoveryService;
+        if (discoveryService == null) {
             discoveryService = new VeluxDiscoveryService(localization);
+            createNew = true;
         }
         discoveryService.addBridge(bridgeHandler);
         if (createNew) {
@@ -81,10 +83,14 @@ public class VeluxHandlerFactory extends BaseThingHandlerFactory {
 
     private synchronized void unregisterDeviceDiscoveryService(VeluxBridgeHandler bridgeHandler) {
         logger.trace("unregisterDeviceDiscoveryService({}) called.", bridgeHandler);
+        VeluxDiscoveryService discoveryService = this.discoveryService;
         if (discoveryService != null) {
             discoveryService.removeBridge(bridgeHandler);
             if (discoveryService.isEmpty()) {
-                discoveryServiceRegistration.unregister();
+                ServiceRegistration<?> discoveryServiceRegistration = this.discoveryServiceRegistration;
+                if (discoveryServiceRegistration != null) {
+                    discoveryServiceRegistration.unregister();
+                }
             }
         }
     }
index c39a3415f988fca779d7a63b6b49050310814aa7..cf178211c424da4e1530385e763c67670ae12a89 100644 (file)
@@ -156,7 +156,6 @@ public class VeluxBridgeHandler extends ExtendedBaseBridgeHandler implements Vel
      * <LI>{@link #wlanConfig} - Information about the gateway configuration.</LI>
      * </UL>
      */
-    @NonNullByDefault
     public class BridgeParameters {
         /** Information retrieved by {@link VeluxBridgeActuators#getProducts} */
         public VeluxBridgeActuators actuators = new VeluxBridgeActuators();
index 6b064c8fdcfb271e364f73df3f9519ddedb1342c..e996293cf80e332340368c9246b87a09c46e4beb 100644 (file)
@@ -66,7 +66,6 @@ public class VeluxKLFAPI {
      * <LI>Method {@link toString} to return a String.</LI>
      * </UL>
      */
-    @NonNullByDefault
     public static class CommandName {
         private String name;
 
@@ -90,7 +89,6 @@ public class VeluxKLFAPI {
      * <LI>Method {@link toString} to return a well-formatted String.</LI>
      * </UL>
      */
-    @NonNullByDefault
     public static class CommandNumber {
         private short commandNumber;
 
@@ -104,7 +102,7 @@ public class VeluxKLFAPI {
 
         @Override
         public String toString() {
-            return "0x" + Integer.toHexString(new Short(commandNumber).intValue());
+            return "0x" + Integer.toHexString(Short.valueOf(commandNumber).intValue());
         }
     }
 
index 383a15ad21309c24a01cc0458d8eaed18ad0fe51..c129af00c92ef8194a01fd70f075d8c0a36f21bc 100644 (file)
@@ -33,7 +33,6 @@ public class VeluxProduct {
 
     // Type definitions
 
-    @NonNullByDefault
     public static class ProductBridgeIndex {
 
         // Public definition
index 9c09412ffc8a87ded9da1fc39a9176a2fd526911..0f2aae40d61638e45659eda2a0fad62e575d3ccb 100644 (file)
@@ -37,7 +37,6 @@ public class VeluxProductState {
 
     // Type definitions
 
-    @NonNullByDefault
     private class ProductState {
 
         private int state;
index 96aa559bcea3b6a69886316eb3f105f4916c3cb8..199edb83914bc9c9cc0859769f1c88ff82293008 100644 (file)
@@ -45,7 +45,6 @@ public class VeluxScene {
 
     // Type definitions
 
-    @NonNullByDefault
     public static class SceneName {
 
         private static final SceneName UNKNOWN = new SceneName(VeluxBindingConstants.UNKNOWN);
@@ -66,7 +65,6 @@ public class VeluxScene {
         }
     }
 
-    @NonNullByDefault
     public static class SceneBridgeIndex {
 
         private static final SceneBridgeIndex UNKNOWN = new SceneBridgeIndex(0);
index 903bde253ea21c9a5a7e829703db3eb88fd9ba7f..f2b7d482a0b3382279874d2d3c66e2c0a6189494 100644 (file)
@@ -53,7 +53,6 @@ public class Localization {
     /**
      * Class, which is needed to maintain a @NonNullByDefault for class {@link Localization}.
      */
-    @NonNullByDefault
     private class UnknownLocale implements LocaleProvider {
         @Override
         public Locale getLocale() {