]> git.basschouten.com Git - openhab-addons.git/commitdiff
[multiple] Reduce SAT warnings (#17564)
authorlsiepel <leosiepel@gmail.com>
Sat, 19 Oct 2024 14:59:52 +0000 (16:59 +0200)
committerGitHub <noreply@github.com>
Sat, 19 Oct 2024 14:59:52 +0000 (16:59 +0200)
* NoEmptyLineSeparatorCheck
* ModifierOrderCheck
* TypeNameCheck
* ConstantNameCheck loggers
* UnusedPrivateField
* Fix imports
* New line
* dynamodb static logger

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
32 files changed:
bundles/org.openhab.binding.airgradient/src/main/java/org/openhab/binding/airgradient/internal/handler/DynamicChannelHelper.java
bundles/org.openhab.binding.bluetooth.daikinmadoka/src/main/java/org/openhab/binding/bluetooth/daikinmadoka/internal/model/MadokaMessage.java
bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothChannelUtils.java
bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/govee/internal/GoveeModel.java
bundles/org.openhab.binding.bluetooth.radoneye/src/main/java/org/openhab/binding/bluetooth/radoneye/internal/RadoneyeDataParser.java
bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinBaseHandler.java
bundles/org.openhab.binding.emotiva/src/main/java/org/openhab/binding/emotiva/internal/EmotivaProcessorHandler.java
bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPFactory.java
bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPHelper.java
bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/api/FroniusHttpUtil.java
bundles/org.openhab.binding.haassohnpelletstove/src/main/java/org/openhab/binding/haassohnpelletstove/internal/HaasSohnpelletstoveJsonDataDTO.java
bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java
bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/logic/CommandTag.java
bundles/org.openhab.binding.mqtt.ruuvigateway/src/main/java/org/openhab/binding/mqtt/ruuvigateway/internal/parser/GatewayPayloadParser.java
bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/LivePanelState.java
bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/NanoleafLayout.java
bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/SecurityCapability.java
bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocolStates.java
bundles/org.openhab.binding.paradoxalarm/src/test/java/org/openhab/binding/paradoxalarm/internal/TestGetBytes.java
bundles/org.openhab.binding.pulseaudio/src/main/java/org/openhab/binding/pulseaudio/internal/ConvertedInputStream.java
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeApi.java
bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api2/ShellyBluApi.java
bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBluSensorHandler.java
bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeAnswer.java
bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeRequest.java
bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiMeasureType.java
bundles/org.openhab.binding.touchwand/src/main/java/org/openhab/binding/touchwand/internal/dto/TouchWandUnitFromJson.java
bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/StatusResource.java
bundles/org.openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/NotificationAction.java
bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java
bundles/org.openhab.persistence.jpa/src/main/java/org/openhab/persistence/jpa/internal/JpaHistoricItem.java
bundles/org.openhab.persistence.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java

index 587e8f8c2851145aa3dc4cb5b167725f7f353cbc..ca8d16322c9fc4a922ae18f2930d067943952924 100644 (file)
@@ -58,7 +58,7 @@ public class DynamicChannelHelper {
         }
     };
 
-    private static final Logger logger = LoggerFactory.getLogger(DynamicChannelHelper.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(DynamicChannelHelper.class);
 
     public static ThingBuilder updateThingWithConfigurationChannels(Thing thing, ThingBuilder builder) {
         for (ConfigurationChannel channel : CHANNELS) {
@@ -72,7 +72,7 @@ public class DynamicChannelHelper {
             ConfigurationChannel toAdd) {
         ChannelUID channelId = new ChannelUID(originalThing.getUID(), toAdd.id);
         if (originalThing.getChannel(channelId) == null) {
-            logger.debug("Adding dynamic channel {} to {}", toAdd.id, originalThing.getUID());
+            LOGGER.debug("Adding dynamic channel {} to {}", toAdd.id, originalThing.getUID());
             ChannelTypeUID typeId = new ChannelTypeUID(BINDING_ID, toAdd.typeId);
             Channel channel = ChannelBuilder.create(channelId, toAdd.itemType).withType(typeId).build();
             builder.withChannel(channel);
index d19a56539af5a4b050758ba0555626e886ed2932..2352a429e18cd41ac653585cda2bda91fa8bd573 100644 (file)
@@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
 @NonNullByDefault
 public class MadokaMessage {
 
-    private static final Logger logger = LoggerFactory.getLogger(MadokaMessage.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(MadokaMessage.class);
 
     private int messageId;
     private final Map<Integer, MadokaValue> values;
@@ -93,7 +93,7 @@ public class MadokaMessage {
 
             return chunks;
         } catch (IOException e) {
-            logger.info("Error while building request", e);
+            LOGGER.info("Error while building request", e);
             throw new RuntimeException(e);
         }
     }
index 47be517e4d66ec460e9b216c8e9bd23e8c450ced..bc9bbdd6a36d87700aca0f928233952d6dbf7235 100644 (file)
@@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
 @NonNullByDefault
 public class BluetoothChannelUtils {
 
-    private static final Logger logger = LoggerFactory.getLogger(BluetoothChannelUtils.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(BluetoothChannelUtils.class);
 
     public static String encodeFieldID(Field field) {
         String requirements = Optional.ofNullable(field.getRequirements()).orElse(Collections.emptyList()).stream()
@@ -130,7 +130,7 @@ public class BluetoothChannelUtils {
         if (fieldType == FieldType.BOOLEAN) {
             OnOffType onOffType = convert(state, OnOffType.class);
             if (onOffType == null) {
-                logger.debug("Could not convert state to OnOffType: {} : {} : {} ", request.getCharacteristicUUID(),
+                LOGGER.debug("Could not convert state to OnOffType: {} : {} : {} ", request.getCharacteristicUUID(),
                         fieldName, state);
                 return;
             }
@@ -144,7 +144,7 @@ public class BluetoothChannelUtils {
                 request.setField(fieldName, enumeration);
                 return;
             } else {
-                logger.debug("Could not convert state to enumeration: {} : {} : {} ", request.getCharacteristicUUID(),
+                LOGGER.debug("Could not convert state to enumeration: {} : {} : {} ", request.getCharacteristicUUID(),
                         fieldName, state);
             }
             // fall back to simple types
@@ -154,7 +154,7 @@ public class BluetoothChannelUtils {
             case SINT: {
                 DecimalType decimalType = convert(state, DecimalType.class);
                 if (decimalType == null) {
-                    logger.debug("Could not convert state to DecimalType: {} : {} : {} ",
+                    LOGGER.debug("Could not convert state to DecimalType: {} : {} : {} ",
                             request.getCharacteristicUUID(), fieldName, state);
                     return;
                 }
@@ -165,7 +165,7 @@ public class BluetoothChannelUtils {
             case FLOAT_IEE11073: {
                 DecimalType decimalType = convert(state, DecimalType.class);
                 if (decimalType == null) {
-                    logger.debug("Could not convert state to DecimalType: {} : {} : {} ",
+                    LOGGER.debug("Could not convert state to DecimalType: {} : {} : {} ",
                             request.getCharacteristicUUID(), fieldName, state);
                     return;
                 }
@@ -176,7 +176,7 @@ public class BluetoothChannelUtils {
             case UTF16S: {
                 StringType textType = convert(state, StringType.class);
                 if (textType == null) {
-                    logger.debug("Could not convert state to StringType: {} : {} : {} ",
+                    LOGGER.debug("Could not convert state to StringType: {} : {} : {} ",
                             request.getCharacteristicUUID(), fieldName, state);
                     return;
                 }
@@ -186,7 +186,7 @@ public class BluetoothChannelUtils {
             case STRUCT:
                 StringType textType = convert(state, StringType.class);
                 if (textType == null) {
-                    logger.debug("Could not convert state to StringType: {} : {} : {} ",
+                    LOGGER.debug("Could not convert state to StringType: {} : {} : {} ",
                             request.getCharacteristicUUID(), fieldName, state);
                     return;
                 }
index 206ef4944f0d526d8714a314bc5fcf87ff4d85cc..d5462f7af22b2cbf3a655c6a5f53afbf31ee6ebb 100644 (file)
@@ -44,7 +44,7 @@ public enum GoveeModel {
     private final String label;
     private final boolean supportsWarningBroadcast;
 
-    private static final Logger logger = LoggerFactory.getLogger(GoveeModel.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(GoveeModel.class);
 
     private GoveeModel(ThingTypeUID thingTypeUID, String label, boolean supportsWarningBroadcast) {
         this.thingTypeUID = thingTypeUID;
@@ -71,13 +71,13 @@ public enum GoveeModel {
                 String uname = name.toUpperCase();
                 for (GoveeModel model : GoveeModel.values()) {
                     if (uname.contains(model.name())) {
-                        logger.debug("detected model {}", model);
+                        LOGGER.debug("detected model {}", model);
                         return model;
                     }
                 }
             }
         }
-        logger.debug("Device {} is no Govee", name);
+        LOGGER.debug("Device {} is no Govee", name);
         return null;
     }
 }
index 4be67f8ec58d7f3cecfd35be77c26a9d8f1afe8c..417634e8c60d29b65a4df9e1c0eb3fe4b2491318 100644 (file)
@@ -34,14 +34,14 @@ public class RadoneyeDataParser {
     private static final int EXPECTED_DATA_LEN_V2 = 12;
     private static final int EXPECTED_VER_PLUS = 1;
 
-    private static final Logger logger = LoggerFactory.getLogger(RadoneyeDataParser.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(RadoneyeDataParser.class);
 
     private RadoneyeDataParser() {
     }
 
     public static Map<String, Number> parseRd200Data(int fwVersion, int[] data) throws RadoneyeParserException {
-        logger.debug("Parsed data length: {}", data.length);
-        logger.debug("Parsed data: {}", data);
+        LOGGER.debug("Parsed data length: {}", data.length);
+        LOGGER.debug("Parsed data: {}", data);
 
         final Map<String, Number> result = new HashMap<>();
 
index ef2976131c353c5b5a0a9a7d82038ae2df530142..26cf8dd0573974fa016c903259eb4032dbbca6e7 100644 (file)
@@ -241,7 +241,6 @@ public abstract class DaikinBaseHandler extends BaseThingHandler {
                 return false;
             }
 
-            boolean changeModeSuccess = false;
             updateState(DaikinBindingConstants.CHANNEL_AC_POWER, OnOffType.from(power));
 
             String newMode = switch (mode) {
index 191a96f1350002875a6bd68190b1e87ecc7951cf..0295100dcff47bfadcfc54cc61da5096f164d0ab 100644 (file)
@@ -226,7 +226,6 @@ public class EmotivaProcessorHandler extends BaseThingHandler {
     private void startPollingKeepAlive() {
         final ScheduledFuture<?> localRefreshJob = this.pollingJob;
         if (localRefreshJob == null || localRefreshJob.isCancelled()) {
-
             Number keepAliveConfig = state.getChannel(EmotivaSubscriptionTags.keepAlive)
                     .filter(channel -> channel instanceof Number).map(keepAlive -> (Number) keepAlive)
                     .orElse(new DecimalType(config.keepAlive));
index 7e9020be245a85d20600ebeb0db9076bad3d8139..47a0150cbea3a524906d9fe2859b75b0f331f046 100644 (file)
@@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
 @NonNullByDefault
 public class EEPFactory {
 
-    private static final Logger logger = LoggerFactory.getLogger(EEPFactory.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(EEPFactory.class);
 
     public static EEP createEEP(EEPType eepType) {
         try {
@@ -70,7 +70,7 @@ public class EEPFactory {
             return cl.getConstructor(ERP1Message.class).newInstance(packet);
         } catch (IllegalAccessException | InstantiationException | IllegalArgumentException | InvocationTargetException
                 | NoSuchMethodException | SecurityException e) {
-            logger.error("Cannot instantiate EEP {}-{}-{}: {}",
+            LOGGER.error("Cannot instantiate EEP {}-{}-{}: {}",
                     HexUtils.bytesToHex(new byte[] { eepType.getRORG().getValue() }),
                     HexUtils.bytesToHex(new byte[] { (byte) eepType.getFunc() }),
                     HexUtils.bytesToHex(new byte[] { (byte) eepType.getType() }), e.getMessage());
@@ -80,16 +80,16 @@ public class EEPFactory {
     }
 
     private static @Nullable EEPType getGenericEEPTypeFor(byte rorg) {
-        logger.info("Received unsupported EEP teach in, trying to fallback to generic thing");
+        LOGGER.info("Received unsupported EEP teach in, trying to fallback to generic thing");
         RORG r = RORG.getRORG(rorg);
         if (r == RORG._4BS) {
-            logger.info("Fallback to 4BS generic thing");
+            LOGGER.info("Fallback to 4BS generic thing");
             return EEPType.Generic4BS;
         } else if (r == RORG.VLD) {
-            logger.info("Fallback to VLD generic thing");
+            LOGGER.info("Fallback to VLD generic thing");
             return EEPType.GenericVLD;
         } else {
-            logger.info("Fallback not possible");
+            LOGGER.info("Fallback not possible");
             return null;
         }
     }
@@ -155,7 +155,7 @@ public class EEPFactory {
             case _4BS: {
                 int db0 = msg.getPayload()[4];
                 if ((db0 & _4BSMessage.LRN_TYPE_MASK) == 0) { // Variation 1
-                    logger.info("Received 4BS Teach In variation 1 without EEP, fallback to generic thing");
+                    LOGGER.info("Received 4BS Teach In variation 1 without EEP, fallback to generic thing");
                     return buildEEP(EEPType.Generic4BS, msg);
                 }
 
@@ -167,7 +167,7 @@ public class EEPFactory {
                 int type = ((db3 & 0b11) << 5) + ((db2 & 0xFF) >>> 3);
                 int manufId = ((db2 & 0b111) << 8) + (db1 & 0xff);
 
-                logger.debug("Received 4BS Teach In with EEP A5-{}-{} and manufacturerID {}",
+                LOGGER.debug("Received 4BS Teach In with EEP A5-{}-{} and manufacturerID {}",
                         HexUtils.bytesToHex(new byte[] { (byte) func }),
                         HexUtils.bytesToHex(new byte[] { (byte) type }),
                         HexUtils.bytesToHex(new byte[] { (byte) manufId }));
@@ -229,7 +229,7 @@ public class EEPFactory {
 
         byte[] senderId = Arrays.copyOfRange(payload, 12, 12 + 4);
 
-        logger.debug("Received SMACK Teach In with EEP {}-{}-{} and manufacturerID {}",
+        LOGGER.debug("Received SMACK Teach In with EEP {}-{}-{} and manufacturerID {}",
                 HexUtils.bytesToHex(new byte[] { (byte) rorg }), HexUtils.bytesToHex(new byte[] { (byte) func }),
                 HexUtils.bytesToHex(new byte[] { (byte) type }), HexUtils.bytesToHex(new byte[] { (byte) manufId }));
 
@@ -263,22 +263,22 @@ public class EEPFactory {
 
         byte priority = event.getPayload()[1];
         if ((priority & 0b1001) == 0b1001) {
-            logger.debug("gtw is already postmaster");
+            LOGGER.debug("gtw is already postmaster");
             if (sendTeachOuts) {
-                logger.debug("Repeated learn is not allow hence send teach out");
+                LOGGER.debug("Repeated learn is not allow hence send teach out");
                 response.setTeachOutResponse();
             } else {
-                logger.debug("Send a repeated learn in");
+                LOGGER.debug("Send a repeated learn in");
                 response.setRepeatedTeachInResponse();
             }
         } else if ((priority & 0b100) == 0) {
-            logger.debug("no place for further mailbox");
+            LOGGER.debug("no place for further mailbox");
             response.setNoPlaceForFurtherMailbox();
         } else if ((priority & 0b10) == 0) {
-            logger.debug("rssi is not good enough");
+            LOGGER.debug("rssi is not good enough");
             response.setBadRSSI();
         } else if ((priority & 0b1) == 0b1) {
-            logger.debug("gtw is candidate for postmaster => teach in");
+            LOGGER.debug("gtw is candidate for postmaster => teach in");
             response.setTeachIn();
         }
 
index b4f4b1e9e3a23816718fb3102dce2033520786a6..c288b210a2b635a3470e5332703f14243cd505b0 100644 (file)
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
  */
 @NonNullByDefault
 public abstract class EEPHelper {
-    private static final Logger logger = LoggerFactory.getLogger(EEPHelper.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(EEPHelper.class);
 
     public static State validateTotalUsage(State value, @Nullable State currentState, Configuration config) {
         EnOceanChannelTotalusageConfig c = config.as(EnOceanChannelTotalusageConfig.class);
@@ -71,10 +71,10 @@ public abstract class EEPHelper {
 
     public static boolean validateUnscaledValue(int unscaledValue, double unscaledMin, double unscaledMax) {
         if (unscaledValue < unscaledMin) {
-            logger.debug("Unscaled value ({}) lower than the minimum allowed ({})", unscaledValue, unscaledMin);
+            LOGGER.debug("Unscaled value ({}) lower than the minimum allowed ({})", unscaledValue, unscaledMin);
             return false;
         } else if (unscaledValue > unscaledMax) {
-            logger.debug("Unscaled value ({}) bigger than the maximum allowed ({})", unscaledValue, unscaledMax);
+            LOGGER.debug("Unscaled value ({}) bigger than the maximum allowed ({})", unscaledValue, unscaledMax);
             return false;
         }
 
index d68245b19cc48046e4d7d16f0c2225a13d2544df..55087efae2edf1fdf97bc26837b635ab4da4be07 100644 (file)
@@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
  */
 @NonNullByDefault
 public class FroniusHttpUtil {
-    private static final Logger logger = LoggerFactory.getLogger(FroniusHttpUtil.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(FroniusHttpUtil.class);
 
     /**
      * Issue a HTTP request and retry on failure.
@@ -82,17 +82,17 @@ public class FroniusHttpUtil {
 
                 if (result != null) {
                     if (attemptCount > 1) {
-                        logger.debug("Attempt #{} successful {}", attemptCount, url);
+                        LOGGER.debug("Attempt #{} successful {}", attemptCount, url);
                     }
                     return result;
                 }
 
                 if (attemptCount >= 3) {
-                    logger.debug("Failed connecting to {} after {} attempts.", url, attemptCount, lastException);
+                    LOGGER.debug("Failed connecting to {} after {} attempts.", url, attemptCount, lastException);
                     throw new FroniusCommunicationException("Unable to connect", lastException);
                 }
 
-                logger.debug("HTTP error on attempt #{} {}", attemptCount, url);
+                LOGGER.debug("HTTP error on attempt #{} {}", attemptCount, url);
                 Thread.sleep(500 * attemptCount);
                 attemptCount++;
             }
index 33192ae11054541f2c7839e53971e987f2ceee46..6b3f72fa5b2952d260ae41a8134e095d946fd245 100644 (file)
@@ -21,7 +21,7 @@ import com.google.gson.annotations.SerializedName;
  * @author Christian Feininger - Initial contribution
  */
 public class HaasSohnpelletstoveJsonDataDTO {
-    metadata meta = new metadata();
+    Metadata meta = new Metadata();
     boolean prg;
     boolean wprg;
     String mode = "";
@@ -32,9 +32,9 @@ public class HaasSohnpelletstoveJsonDataDTO {
     @SerializedName("ht_char")
     String htChar = "";
     @SerializedName("weekprogram")
-    private wprogram[] weekprogram;
+    private Wprogram[] weekprogram;
     @SerializedName("error")
-    private err[] error;
+    private Err[] error;
     @SerializedName("eco_mode")
     boolean ecoMode;
     boolean pgi;
@@ -98,7 +98,7 @@ public class HaasSohnpelletstoveJsonDataDTO {
         return this;
     }
 
-    public class metadata {
+    public class Metadata {
         @SerializedName("sw_version")
         String swVersion = "";
         @SerializedName("hw_version")
@@ -119,19 +119,19 @@ public class HaasSohnpelletstoveJsonDataDTO {
         String ean = "";
         boolean rau;
         @SerializedName("wlan_features")
-        private String[] wlan_features;
+        private String[] wlanFeatures;
 
         public String getNonce() {
             return nonce;
         }
     }
 
-    public class err {
+    public class Err {
         String time = "";
         String nr = "";
     }
 
-    public class wprogram {
+    public class Wprogram {
         String day = "";
         String begin = "";
         String end = "";
index 8e86099f12d663e3795b209926d8aab6c64b5fe7..8b438de52ee161f9f2482456a33896dc0eddc45d 100644 (file)
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 @NonNullByDefault
 public class HeosActions implements ThingActions {
 
-    private static final Logger logger = LoggerFactory.getLogger(HeosActions.class);
+    private final Logger logger = LoggerFactory.getLogger(HeosActions.class);
 
     private @Nullable HeosBridgeHandler handler;
 
index 451a7377530d48626be4d112ba69581d9f344660..30588949262ae1084b2ff9abbbf5cc3f99125771 100644 (file)
@@ -56,7 +56,7 @@ public class CommandTag {
 
     private static final List<Class<? extends Command>> percentCommandType = Arrays.asList(PercentType.class);
 
-    private static final Logger logger = LoggerFactory.getLogger(CommandTag.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(CommandTag.class);
 
     private String inputLine;
     private CommandTagType tagType;
@@ -150,15 +150,15 @@ public class CommandTag {
 
     public static @Nullable CommandTag createCommandTag(String inputLine) {
         if (inputLine.isEmpty() || !CommandTagType.prefixValid(inputLine)) {
-            logger.trace("Command Tag Trace: \"{}\" => NOT a (valid) Command Tag!", inputLine);
+            LOGGER.trace("Command Tag Trace: \"{}\" => NOT a (valid) Command Tag!", inputLine);
             return null;
         }
         try {
             final CommandTag tag = new CommandTag(inputLine);
-            logger.trace("Command Tag Trace: \"{}\" => Fully valid Command Tag!", inputLine);
+            LOGGER.trace("Command Tag Trace: \"{}\" => Fully valid Command Tag!", inputLine);
             return tag;
         } catch (IllegalArgumentException e) {
-            logger.warn("{}", e.getMessage());
+            LOGGER.warn("{}", e.getMessage());
             return null;
         }
     }
index e87e4b7277d34b9c7d4bd60ce76756628ea72065..8369531646cabb2e1a2007391e9764d603f1a12b 100644 (file)
@@ -41,7 +41,7 @@ import fi.tkgwf.ruuvi.common.parser.impl.AnyDataFormatParser;
 @NonNullByDefault
 public class GatewayPayloadParser {
 
-    private static final Logger logger = LoggerFactory.getLogger(GatewayPayloadParser.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(GatewayPayloadParser.class);
     private static final Gson GSON = new GsonBuilder().create();
     private static final AnyDataFormatParser parser = new AnyDataFormatParser();
     private static final Predicate<String> HEX_PATTERN_CHECKER = Pattern.compile("^([0-9A-Fa-f]{2})+$")
@@ -80,19 +80,19 @@ public class GatewayPayloadParser {
         private GatewayPayload(GatewayPayloadIntermediate intermediate) throws IllegalArgumentException {
             String gwMac = intermediate.gw_mac;
             if (gwMac == null) {
-                logger.trace("Missing mandatory field 'gw_mac', ignoring");
+                LOGGER.trace("Missing mandatory field 'gw_mac', ignoring");
             }
             this.gwMac = Optional.ofNullable(gwMac);
             rssi = intermediate.rssi;
             try {
                 gwts = Optional.of(Instant.ofEpochSecond(intermediate.gwts));
             } catch (DateTimeException e) {
-                logger.debug("Field 'gwts' is a not valid time (epoch second), ignoring: {}", intermediate.gwts);
+                LOGGER.debug("Field 'gwts' is a not valid time (epoch second), ignoring: {}", intermediate.gwts);
             }
             try {
                 ts = Optional.of(Instant.ofEpochSecond(intermediate.ts));
             } catch (DateTimeException e) {
-                logger.debug("Field 'ts' is a not valid time (epoch second), ignoring: {}", intermediate.ts);
+                LOGGER.debug("Field 'ts' is a not valid time (epoch second), ignoring: {}", intermediate.ts);
             }
 
             String localData = intermediate.data;
@@ -101,7 +101,7 @@ public class GatewayPayloadParser {
             }
 
             if (!HEX_PATTERN_CHECKER.test(localData)) {
-                logger.debug(
+                LOGGER.debug(
                         "Data is not representing manufacturer specific bluetooth advertisement, it is not valid hex: {}",
                         localData);
                 throw new IllegalArgumentException(
@@ -116,7 +116,7 @@ public class GatewayPayloadParser {
                 throw new IllegalArgumentException("Manufacturerer data is too short");
             }
             if ((bytes[4] & 0xff) != 0xff) {
-                logger.debug("Data is not representing manufacturer specific bluetooth advertisement: {}",
+                LOGGER.debug("Data is not representing manufacturer specific bluetooth advertisement: {}",
                         HexUtils.bytesToHex(bytes));
                 throw new IllegalArgumentException(
                         "Data is not representing manufacturer specific bluetooth advertisement");
@@ -125,7 +125,7 @@ public class GatewayPayloadParser {
             byte[] manufacturerData = Arrays.copyOfRange(bytes, 5, bytes.length);
             RuuviMeasurement localManufacturerData = parser.parse(manufacturerData);
             if (localManufacturerData == null) {
-                logger.trace("Manufacturer data is not valid: {}", HexUtils.bytesToHex(manufacturerData));
+                LOGGER.trace("Manufacturer data is not valid: {}", HexUtils.bytesToHex(manufacturerData));
                 throw new IllegalArgumentException("Manufacturer data is not valid");
             }
             measurement = localManufacturerData;
index de2c60ed325a5c664e444fb362aee9b84a2c80a5..09c93d1344e612a671fe0fdeabf356a32f38acf0 100644 (file)
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
 @NonNullByDefault
 public class LivePanelState implements PanelState {
 
-    private static final Logger logger = LoggerFactory.getLogger(LivePanelState.class);
+    private final Logger logger = LoggerFactory.getLogger(LivePanelState.class);
     private final NanoleafPanelColors panelColors;
 
     public LivePanelState(NanoleafPanelColors panelColors) {
index 782383dbfe73f39e6d5b1d5c952668325d4ee1b4..ed7c2882480b390561b42d6008045ad355a48f8d 100644 (file)
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
 @NonNullByDefault
 public class NanoleafLayout {
 
-    private static final Logger logger = LoggerFactory.getLogger(NanoleafLayout.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(NanoleafLayout.class);
     private static final Color COLOR_BACKGROUND = Color.WHITE;
 
     public static byte[] render(PanelLayout panelLayout, PanelState state, LayoutSettings settings) throws IOException {
@@ -53,13 +53,13 @@ public class NanoleafLayout {
 
         Layout layout = panelLayout.getLayout();
         if (layout == null) {
-            logger.warn("Returning no image as we don't have any layout to render");
+            LOGGER.warn("Returning no image as we don't have any layout to render");
             return new byte[] {};
         }
 
         List<PositionDatum> positionDatums = layout.getPositionData();
         if (positionDatums == null) {
-            logger.warn("Returning no image as we don't have any position datums to render");
+            LOGGER.warn("Returning no image as we don't have any position datums to render");
             return new byte[] {};
         }
 
index 255c7754f97a5f79d631553d8611d33f63d04330..ac0a9b0b3c22e81077213ae8a34cec02a5a3515e 100644 (file)
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
  */
 @NonNullByDefault
 class SecurityCapability extends RestCapability<SecurityApi> {
-    private final static ZonedDateTime ZDT_REFERENCE = ZonedDateTime.ofInstant(Instant.ofEpochMilli(0),
+    private static final ZonedDateTime ZDT_REFERENCE = ZonedDateTime.ofInstant(Instant.ofEpochMilli(0),
             ZoneId.systemDefault());
 
     private final Logger logger = LoggerFactory.getLogger(SecurityCapability.class);
index bbb7448bdaba15d97c4d38e04c504c5acdb99df5..a409863e871d884c2d5e319a7ea3bdb18542457a 100644 (file)
@@ -60,7 +60,7 @@ public enum NibeHeatPumpProtocolStates implements NibeHeatPumpProtocolState {
                     context.msg().put(b);
 
                     try {
-                        msgStatus status = checkNibeMessage(context.msg().asReadOnlyBuffer());
+                        MsgStatus status = checkNibeMessage(context.msg().asReadOnlyBuffer());
                         switch (status) {
                             case INVALID:
                                 context.state(WAIT_START);
@@ -130,7 +130,7 @@ public enum NibeHeatPumpProtocolStates implements NibeHeatPumpProtocolState {
         }
     };
 
-    private enum msgStatus {
+    private enum MsgStatus {
         VALID,
         VALID_BUT_NOT_READY,
         INVALID
@@ -139,13 +139,13 @@ public enum NibeHeatPumpProtocolStates implements NibeHeatPumpProtocolState {
     /*
      * Throws NibeHeatPumpException when checksum fails
      */
-    private static msgStatus checkNibeMessage(ByteBuffer byteBuffer) throws NibeHeatPumpException {
+    private static MsgStatus checkNibeMessage(ByteBuffer byteBuffer) throws NibeHeatPumpException {
         byteBuffer.flip();
         int len = byteBuffer.remaining();
 
         if (len >= 1) {
             if (byteBuffer.get(0) != NibeHeatPumpProtocol.FRAME_START_CHAR_RES) {
-                return msgStatus.INVALID;
+                return MsgStatus.INVALID;
             }
 
             if (len >= 6) {
@@ -153,7 +153,7 @@ public enum NibeHeatPumpProtocolStates implements NibeHeatPumpProtocolState {
 
                 // check if all bytes received
                 if (len < datalen + 6) {
-                    return msgStatus.VALID_BUT_NOT_READY;
+                    return MsgStatus.VALID_BUT_NOT_READY;
                 }
 
                 // calculate XOR checksum
@@ -173,11 +173,11 @@ public enum NibeHeatPumpProtocolStates implements NibeHeatPumpProtocolState {
                     }
                 }
 
-                return msgStatus.VALID;
+                return MsgStatus.VALID;
             }
         }
 
-        return msgStatus.VALID_BUT_NOT_READY;
+        return MsgStatus.VALID_BUT_NOT_READY;
     }
 
     private static final Logger LOGGER = LoggerFactory.getLogger(NibeHeatPumpProtocolStates.class);
index 3ccf9b1c32811c290f968af65bc0b24850fedc97..0b4993a054fd14edbbc351afebac418c92ce2615 100644 (file)
@@ -45,7 +45,7 @@ public class TestGetBytes {
         System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "TRACE");
     }
 
-    private static final Logger logger = LoggerFactory.getLogger(ParadoxUtil.class);
+    private final Logger logger = LoggerFactory.getLogger(ParadoxUtil.class);
 
     private static final byte[] EXPECTED1 = { (byte) 0xAA, 0x0A, 0x00, 0x03, 0x08, (byte) 0xF0, 0x00, 0x00, 0x01,
             (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, 0x01, 0x02, 0x03,
index 4a438fa6dcf677e629c9e0c242f6b863263cba48..2a59dea603eb5081b32ddfb44c51b7fc94e139c7 100644 (file)
@@ -76,7 +76,6 @@ public class ConvertedInputStream extends AudioStream {
             if (container.equals(AudioFormat.CONTAINER_WAVE)) {
                 AudioWaveUtils.removeFMT(innerInputStream);
             }
-
         } else {
             pcmInnerInputStream = getPCMStream(new BufferedInputStream(innerInputStream));
             var javaAudioFormat = ((AudioInputStream) pcmInnerInputStream).getFormat();
index 20b8c1528909e2aebd9fcad0db50b1dbf7929ef4..f21858bd40921093385e52f79be69a085cda7df1 100644 (file)
@@ -73,7 +73,6 @@ public class SenecHomeApi {
      */
     public SenecHomeResponse getStatistics()
             throws TimeoutException, ExecutionException, IOException, InterruptedException, JsonSyntaxException {
-
         String dataToSend = gson.toJson(new SenecHomeResponse());
         ContentResponse response = postRequest(dataToSend);
         return Objects.requireNonNull(gson.fromJson(response.getContentAsString(), SenecHomeResponse.class));
index 1ef791d311f09171da793469b3f26b2a25c58584..e9cec235884647765e1f4b0ca27306d3cfdbc7d2 100644 (file)
@@ -54,7 +54,7 @@ import org.slf4j.LoggerFactory;
  */
 @NonNullByDefault
 public class ShellyBluApi extends Shelly2ApiRpc {
-    private static final Logger logger = LoggerFactory.getLogger(ShellyBluApi.class);
+    private final Logger logger = LoggerFactory.getLogger(ShellyBluApi.class);
     private boolean connected = false; // true = BLU devices has connected
     private ShellySettingsStatus deviceStatus = new ShellySettingsStatus();
     private int lastPid = -1;
index 7c98243e498f1b6ad456718b8d1ff13be8c1eb3d..645a9a5fbf010e5cd9d6894c45635edc4ec302fc 100644 (file)
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
  */
 @NonNullByDefault
 public class ShellyBluSensorHandler extends ShellyBaseHandler {
-    private static final Logger logger = LoggerFactory.getLogger(ShellyBluSensorHandler.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(ShellyBluSensorHandler.class);
 
     public ShellyBluSensorHandler(final Thing thing, final ShellyTranslationProvider translationProvider,
             final ShellyBindingConfiguration bindingConfig, final ShellyThingTable thingTable,
@@ -50,7 +50,7 @@ public class ShellyBluSensorHandler extends ShellyBaseHandler {
 
     @Override
     public void initialize() {
-        logger.debug("Thing is using  {}", this.getClass());
+        LOGGER.debug("Thing is using  {}", this.getClass());
         super.initialize();
     }
 
@@ -58,7 +58,7 @@ public class ShellyBluSensorHandler extends ShellyBaseHandler {
         String model = substringBefore(getString(e.data.name), "-").toUpperCase();
         String mac = e.data.addr.replaceAll(":", "");
         String ttype = "";
-        logger.debug("{}: Create thing for new BLU device {}: {} / {}", gateway, e.data.name, model, mac);
+        LOGGER.debug("{}: Create thing for new BLU device {}: {} / {}", gateway, e.data.name, model, mac);
         ThingTypeUID tuid;
         switch (model) {
             case SHELLYDT_BLUBUTTON:
@@ -78,7 +78,7 @@ public class ShellyBluSensorHandler extends ShellyBaseHandler {
                 tuid = THING_TYPE_SHELLYBLUHT;
                 break;
             default:
-                logger.debug("{}: Unsupported BLU device model {}, MAC={}", gateway, model, mac);
+                LOGGER.debug("{}: Unsupported BLU device model {}, MAC={}", gateway, model, mac);
                 return;
         }
         String serviceName = ShellyDeviceProfile.buildBluServiceName(getString(e.data.name), mac);
index 45c4671fccfadea9f252901c2761e15304845f5d..6bf2ae3d2d6ed7d0178be922e290c11902432862 100644 (file)
@@ -29,8 +29,7 @@ import org.slf4j.LoggerFactory;
  */
 public abstract class SinopeAnswer extends SinopeRequest {
 
-    /** The Constant logger. */
-    private static final Logger logger = LoggerFactory.getLogger(SinopeAnswer.class);
+    private final Logger logger = LoggerFactory.getLogger(SinopeAnswer.class);
 
     /**
      * Instantiates a new sinope answer.
index 17f6e16e7775a8c4ef12d4707e188ad57babfb4a..cb2baf6730078d5b34716a2af44198d6e43196fe 100644 (file)
@@ -32,8 +32,7 @@ public abstract class SinopeRequest extends SinopeFrame {
     protected static final int HEADER_COMMAND_CRC_SIZE = SinopeFrame.PREAMBLE_SIZE + SinopeFrame.FRAME_CTL_SIZE
             + SinopeFrame.SIZE_SIZE + SinopeFrame.COMMAND_SIZE + SinopeFrame.CRC_SIZE;
 
-    /** The Constant logger. */
-    private static final Logger logger = LoggerFactory.getLogger(SinopeRequest.class);
+    private final Logger logger = LoggerFactory.getLogger(SinopeRequest.class);
 
     /**
      * @see org.openhab.binding.sinope.internal.core.base.SinopeFrame#getPayload()
index ff175cb4fee4a3692e746845ab3bf5836b55f6e9..398638cf8a924cd6b3d6cdc1bb205dcaf66d61e0 100644 (file)
@@ -55,7 +55,7 @@ public enum TACmiMeasureType {
     private final int typeval;
     private final int offset;
 
-    private static final Logger logger = LoggerFactory.getLogger(TACmiMeasureType.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(TACmiMeasureType.class);
 
     private TACmiMeasureType(int typeval, int offset) {
         this.typeval = typeval;
@@ -79,7 +79,7 @@ public enum TACmiMeasureType {
                 return mtype;
             }
         }
-        logger.debug("Received unexpected measure type {}", type);
+        LOGGER.debug("Received unexpected measure type {}", type);
         return TACmiMeasureType.UNSUPPORTED;
     }
 }
index a6635208f68fc712d9e553f78d2ddf59d6a49f3a..d797fa95ad7b1303da90f06c6c7c7904df5e1517 100644 (file)
@@ -34,7 +34,7 @@ import com.google.gson.JsonParser;
 @NonNullByDefault
 public class TouchWandUnitFromJson {
 
-    private static final Logger logger = LoggerFactory.getLogger(TouchWandUnitFromJson.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(TouchWandUnitFromJson.class);
 
     public TouchWandUnitFromJson() {
     }
@@ -93,7 +93,7 @@ public class TouchWandUnitFromJson {
             unitObj = JsonParser.parseString(JsonUnit).getAsJsonObject();
             myTouchWandUnitData = parseResponse(unitObj);
         } catch (JsonParseException | IllegalStateException e) {
-            logger.warn("Could not parse response {}", JsonUnit);
+            LOGGER.warn("Could not parse response {}", JsonUnit);
             myTouchWandUnitData = new TouchWandUnknownTypeUnitData(); // Return unknown type
         }
         return myTouchWandUnitData;
index 2449abd6f7d792c3225bdb304f5e42a77c0352cc..cccb4377bbc391bf16176fd1e6be8ce81cbfc105 100644 (file)
@@ -66,7 +66,7 @@ public class StatusResource implements RegistryListener {
     @Reference
     protected @NonNullByDefault({}) UpnpService upnpService;
 
-    private enum upnpStatus {
+    private enum UpnpStatus {
         service_not_registered,
         service_registered_but_no_UPnP_traffic_yet,
         upnp_announcement_thread_not_running,
@@ -74,7 +74,7 @@ public class StatusResource implements RegistryListener {
         success
     }
 
-    private upnpStatus selfTestUpnpFound = upnpStatus.service_not_registered;
+    private UpnpStatus selfTestUpnpFound = UpnpStatus.service_not_registered;
 
     private final Logger logger = LoggerFactory.getLogger(StatusResource.class);
 
@@ -89,7 +89,7 @@ public class StatusResource implements RegistryListener {
             return;
         }
 
-        selfTestUpnpFound = upnpStatus.service_registered_but_no_UPnP_traffic_yet;
+        selfTestUpnpFound = UpnpStatus.service_registered_but_no_UPnP_traffic_yet;
 
         for (RemoteDevice device : registry.getRemoteDevices()) {
             remoteDeviceAdded(registry, device);
@@ -171,7 +171,7 @@ public class StatusResource implements RegistryListener {
         }
 
         if (!localDiscovery.upnpAnnouncementThreadRunning()) {
-            selfTestUpnpFound = upnpStatus.upnp_announcement_thread_not_running;
+            selfTestUpnpFound = UpnpStatus.upnp_announcement_thread_not_running;
         }
 
         return String.format(format, cs.ds.config.linkbutton ? "On" : "Off",
@@ -194,7 +194,7 @@ public class StatusResource implements RegistryListener {
     @NonNullByDefault({})
     @Override
     public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
-        if (selfTestUpnpFound == upnpStatus.success) {
+        if (selfTestUpnpFound == UpnpStatus.success) {
             return;
         }
         checkForDevice(getDetails(device));
@@ -211,10 +211,10 @@ public class StatusResource implements RegistryListener {
     }
 
     private void checkForDevice(DeviceDetails details) {
-        selfTestUpnpFound = upnpStatus.any_device_but_not_this_one_found;
+        selfTestUpnpFound = UpnpStatus.any_device_but_not_this_one_found;
         try {
             if (cs.ds.config.bridgeid.equals(details.getSerialNumber())) {
-                selfTestUpnpFound = upnpStatus.success;
+                selfTestUpnpFound = UpnpStatus.success;
             }
         } catch (Exception e) { // We really don't want the service to fail on any exception
             logger.warn("upnp service: adding services failed: {}", details.getFriendlyName(), e);
@@ -230,14 +230,14 @@ public class StatusResource implements RegistryListener {
     @Override
     public void remoteDeviceRemoved(Registry registry, RemoteDevice device) {
         UpnpServer localDiscovery = discovery;
-        if (selfTestUpnpFound != upnpStatus.success || localDiscovery == null
+        if (selfTestUpnpFound != UpnpStatus.success || localDiscovery == null
                 || localDiscovery.upnpAnnouncementThreadRunning()) {
             return;
         }
         DeviceDetails details = getDetails(device);
         String serialNo = details.getSerialNumber();
         if (cs.ds.config.bridgeid.equals(serialNo)) {
-            selfTestUpnpFound = upnpStatus.any_device_but_not_this_one_found;
+            selfTestUpnpFound = UpnpStatus.any_device_but_not_this_one_found;
         }
     }
 
@@ -245,7 +245,7 @@ public class StatusResource implements RegistryListener {
     @Override
     public void localDeviceAdded(Registry registry, LocalDevice device) {
         UpnpServer localDiscovery = discovery;
-        if (selfTestUpnpFound == upnpStatus.success || localDiscovery == null
+        if (selfTestUpnpFound == UpnpStatus.success || localDiscovery == null
                 || localDiscovery.upnpAnnouncementThreadRunning()) {
             return;
         }
@@ -264,6 +264,6 @@ public class StatusResource implements RegistryListener {
 
     @Override
     public void afterShutdown() {
-        selfTestUpnpFound = upnpStatus.service_not_registered;
+        selfTestUpnpFound = UpnpStatus.service_not_registered;
     }
 }
index 17027c9e5190a273821f176b444d5a53cb4f43e7..f47b91975549ee456df1610c4b9db91e2769492c 100644 (file)
@@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
 @NonNullByDefault
 public class NotificationAction {
 
-    private static final Logger logger = LoggerFactory.getLogger(NotificationAction.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(NotificationAction.class);
 
     public static @Nullable CloudService cloudService;
 
@@ -81,7 +81,7 @@ public class NotificationAction {
             @Nullable String title, @Nullable String referenceId, @Nullable String onClickAction,
             @Nullable String mediaAttachmentUrl, @Nullable String actionButton1, @Nullable String actionButton2,
             @Nullable String actionButton3) {
-        logger.debug("sending notification '{}' to user {}", message, userId);
+        LOGGER.debug("sending notification '{}' to user {}", message, userId);
         if (cloudService != null) {
             cloudService.sendNotification(userId, message, icon, tag, title, referenceId, onClickAction,
                     mediaAttachmentUrl, actionButton1, actionButton2, actionButton3);
@@ -111,7 +111,7 @@ public class NotificationAction {
      */
     @ActionDoc(text = "Sends a log notification which is shown in notifications log to all account users")
     public static void sendLogNotification(String message, @Nullable String icon, @Nullable String tag) {
-        logger.debug("sending log notification '{}'", message);
+        LOGGER.debug("sending log notification '{}'", message);
         if (cloudService != null) {
             cloudService.sendLogNotification(message, icon, tag);
         }
@@ -164,7 +164,7 @@ public class NotificationAction {
             @Nullable String title, @Nullable String referenceId, @Nullable String onClickAction,
             @Nullable String mediaAttachmentUrl, @Nullable String actionButton1, @Nullable String actionButton2,
             @Nullable String actionButton3) {
-        logger.debug("sending broadcast notification '{}' to all users", message);
+        LOGGER.debug("sending broadcast notification '{}' to all users", message);
         if (cloudService != null) {
             cloudService.sendBroadcastNotification(message, icon, tag, title, referenceId, onClickAction,
                     mediaAttachmentUrl, actionButton1, actionButton2, actionButton3);
index 5b96dec86956bb9bd9971c7d205c99e627ec785c..55f39ccf1b2cd78d6609271f5b9f8d722d050053 100644 (file)
@@ -108,7 +108,7 @@ public class DynamoDBPersistenceService implements QueryablePersistenceService {
     private final UnitProvider unitProvider;
     private @Nullable DynamoDbEnhancedAsyncClient client;
     private @Nullable DynamoDbAsyncClient lowLevelClient;
-    private static final Logger logger = LoggerFactory.getLogger(DynamoDBPersistenceService.class);
+    private final Logger logger = LoggerFactory.getLogger(DynamoDBPersistenceService.class);
     private boolean isProperlyConfigured;
     private @Nullable DynamoDBConfig dbConfig;
     private @Nullable DynamoDBTableNameResolver tableNameResolver;
@@ -645,7 +645,8 @@ public class DynamoDBPersistenceService implements QueryablePersistenceService {
             if (itemUnit != null) {
                 State convertedState = type.toUnit(itemUnit);
                 if (convertedState == null) {
-                    logger.error("Unexpected unit conversion failure: {} to item unit {}", state, itemUnit);
+                    LoggerFactory.getLogger(DynamoDBPersistenceService.class)
+                            .error("Unexpected unit conversion failure: {} to item unit {}", state, itemUnit);
                     throw new IllegalArgumentException(
                             String.format("Unexpected unit conversion failure: %s to item unit %s", state, itemUnit));
                 }
index ec7f7d8a12b4b4b2b8844c5790cb759f33806068..3752661b5e34f62f575d098a909dd142d59a1515 100644 (file)
@@ -57,7 +57,7 @@ import org.slf4j.LoggerFactory;
  */
 @NonNullByDefault
 public class JpaHistoricItem implements HistoricItem {
-    private static final Logger logger = LoggerFactory.getLogger(JpaHistoricItem.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(JpaHistoricItem.class);
 
     private final String name;
     private final State state;
@@ -123,7 +123,7 @@ public class JpaHistoricItem implements HistoricItem {
                 // Ensure we return in the item's unit
                 state = value.toUnit(unit);
                 if (state == null) {
-                    logger.warn("Persisted state {} for item {} is incompatible with item's unit {}; ignoring", value,
+                    LOGGER.warn("Persisted state {} for item {} is incompatible with item's unit {}; ignoring", value,
                             item.getName(), unit);
                     return null;
                 }
index eaca9697b6bc0a7f1073bd890aeb7e5c3079c350..cc3bc3771e9bd44b4261292881b901f5cb9f732a 100644 (file)
@@ -115,7 +115,7 @@ public class MongoDBTypeConversions {
         return STATE_CONVERTERS.getOrDefault(state.getClass(), State::toString).apply(state);
     }
 
-    private static final Logger logger = LoggerFactory.getLogger(MongoDBTypeConversions.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(MongoDBTypeConversions.class);
 
     /**
      * A map of converters that convert openHAB states to MongoDB compatible types.
@@ -199,7 +199,7 @@ public class MongoDBTypeConversions {
         if (value instanceof String) {
             return new HSBType(value.toString());
         } else {
-            logger.warn("HSBType ({}) value is not a valid string: {}", doc.getString(MongoDBFields.FIELD_REALNAME),
+            LOGGER.warn("HSBType ({}) value is not a valid string: {}", doc.getString(MongoDBFields.FIELD_REALNAME),
                     value);
             return new HSBType("0,0,0");
         }
@@ -249,7 +249,7 @@ public class MongoDBTypeConversions {
             Binary data = fieldValue.get(MongoDBFields.FIELD_VALUE_DATA, Binary.class);
             return new RawType(data.getData(), type);
         } else {
-            logger.warn("ImageItem ({}) value is not a Document: {}", doc.getString(MongoDBFields.FIELD_REALNAME),
+            LOGGER.warn("ImageItem ({}) value is not a Document: {}", doc.getString(MongoDBFields.FIELD_REALNAME),
                     value);
             return new RawType(new byte[0], "application/octet-stream");
         }