From: lsiepel Date: Sat, 19 Oct 2024 14:59:52 +0000 (+0200) Subject: [multiple] Reduce SAT warnings (#17564) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=455330e741d3e7d7abd16e4231a25dfa24e6f4ba;p=openhab-addons.git [multiple] Reduce SAT warnings (#17564) * NoEmptyLineSeparatorCheck * ModifierOrderCheck * TypeNameCheck * ConstantNameCheck loggers * UnusedPrivateField * Fix imports * New line * dynamodb static logger Signed-off-by: Leo Siepel --- diff --git a/bundles/org.openhab.binding.airgradient/src/main/java/org/openhab/binding/airgradient/internal/handler/DynamicChannelHelper.java b/bundles/org.openhab.binding.airgradient/src/main/java/org/openhab/binding/airgradient/internal/handler/DynamicChannelHelper.java index 587e8f8c28..ca8d16322c 100644 --- a/bundles/org.openhab.binding.airgradient/src/main/java/org/openhab/binding/airgradient/internal/handler/DynamicChannelHelper.java +++ b/bundles/org.openhab.binding.airgradient/src/main/java/org/openhab/binding/airgradient/internal/handler/DynamicChannelHelper.java @@ -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); diff --git a/bundles/org.openhab.binding.bluetooth.daikinmadoka/src/main/java/org/openhab/binding/bluetooth/daikinmadoka/internal/model/MadokaMessage.java b/bundles/org.openhab.binding.bluetooth.daikinmadoka/src/main/java/org/openhab/binding/bluetooth/daikinmadoka/internal/model/MadokaMessage.java index d19a56539a..2352a429e1 100644 --- a/bundles/org.openhab.binding.bluetooth.daikinmadoka/src/main/java/org/openhab/binding/bluetooth/daikinmadoka/internal/model/MadokaMessage.java +++ b/bundles/org.openhab.binding.bluetooth.daikinmadoka/src/main/java/org/openhab/binding/bluetooth/daikinmadoka/internal/model/MadokaMessage.java @@ -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 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); } } diff --git a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothChannelUtils.java b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothChannelUtils.java index 47be517e4d..bc9bbdd6a3 100644 --- a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothChannelUtils.java +++ b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothChannelUtils.java @@ -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; } diff --git a/bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/govee/internal/GoveeModel.java b/bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/govee/internal/GoveeModel.java index 206ef4944f..d5462f7af2 100644 --- a/bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/govee/internal/GoveeModel.java +++ b/bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/govee/internal/GoveeModel.java @@ -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; } } diff --git a/bundles/org.openhab.binding.bluetooth.radoneye/src/main/java/org/openhab/binding/bluetooth/radoneye/internal/RadoneyeDataParser.java b/bundles/org.openhab.binding.bluetooth.radoneye/src/main/java/org/openhab/binding/bluetooth/radoneye/internal/RadoneyeDataParser.java index 4be67f8ec5..417634e8c6 100644 --- a/bundles/org.openhab.binding.bluetooth.radoneye/src/main/java/org/openhab/binding/bluetooth/radoneye/internal/RadoneyeDataParser.java +++ b/bundles/org.openhab.binding.bluetooth.radoneye/src/main/java/org/openhab/binding/bluetooth/radoneye/internal/RadoneyeDataParser.java @@ -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 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 result = new HashMap<>(); diff --git a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinBaseHandler.java b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinBaseHandler.java index ef2976131c..26cf8dd057 100644 --- a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinBaseHandler.java +++ b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinBaseHandler.java @@ -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) { diff --git a/bundles/org.openhab.binding.emotiva/src/main/java/org/openhab/binding/emotiva/internal/EmotivaProcessorHandler.java b/bundles/org.openhab.binding.emotiva/src/main/java/org/openhab/binding/emotiva/internal/EmotivaProcessorHandler.java index 191a96f135..0295100dcf 100644 --- a/bundles/org.openhab.binding.emotiva/src/main/java/org/openhab/binding/emotiva/internal/EmotivaProcessorHandler.java +++ b/bundles/org.openhab.binding.emotiva/src/main/java/org/openhab/binding/emotiva/internal/EmotivaProcessorHandler.java @@ -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)); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPFactory.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPFactory.java index 7e9020be24..47a0150cbe 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPFactory.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPFactory.java @@ -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(); } diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPHelper.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPHelper.java index b4f4b1e9e3..c288b210a2 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPHelper.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPHelper.java @@ -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; } diff --git a/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/api/FroniusHttpUtil.java b/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/api/FroniusHttpUtil.java index d68245b19c..55087efae2 100644 --- a/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/api/FroniusHttpUtil.java +++ b/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/api/FroniusHttpUtil.java @@ -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++; } diff --git a/bundles/org.openhab.binding.haassohnpelletstove/src/main/java/org/openhab/binding/haassohnpelletstove/internal/HaasSohnpelletstoveJsonDataDTO.java b/bundles/org.openhab.binding.haassohnpelletstove/src/main/java/org/openhab/binding/haassohnpelletstove/internal/HaasSohnpelletstoveJsonDataDTO.java index 33192ae110..6b3f72fa5b 100644 --- a/bundles/org.openhab.binding.haassohnpelletstove/src/main/java/org/openhab/binding/haassohnpelletstove/internal/HaasSohnpelletstoveJsonDataDTO.java +++ b/bundles/org.openhab.binding.haassohnpelletstove/src/main/java/org/openhab/binding/haassohnpelletstove/internal/HaasSohnpelletstoveJsonDataDTO.java @@ -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 = ""; diff --git a/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java b/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java index 8e86099f12..8b438de52e 100644 --- a/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java +++ b/bundles/org.openhab.binding.heos/src/main/java/org/openhab/binding/heos/internal/action/HeosActions.java @@ -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; diff --git a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/logic/CommandTag.java b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/logic/CommandTag.java index 451a737753..3058894926 100644 --- a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/logic/CommandTag.java +++ b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/logic/CommandTag.java @@ -56,7 +56,7 @@ public class CommandTag { private static final List> 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; } } diff --git a/bundles/org.openhab.binding.mqtt.ruuvigateway/src/main/java/org/openhab/binding/mqtt/ruuvigateway/internal/parser/GatewayPayloadParser.java b/bundles/org.openhab.binding.mqtt.ruuvigateway/src/main/java/org/openhab/binding/mqtt/ruuvigateway/internal/parser/GatewayPayloadParser.java index e87e4b7277..8369531646 100644 --- a/bundles/org.openhab.binding.mqtt.ruuvigateway/src/main/java/org/openhab/binding/mqtt/ruuvigateway/internal/parser/GatewayPayloadParser.java +++ b/bundles/org.openhab.binding.mqtt.ruuvigateway/src/main/java/org/openhab/binding/mqtt/ruuvigateway/internal/parser/GatewayPayloadParser.java @@ -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 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; diff --git a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/LivePanelState.java b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/LivePanelState.java index de2c60ed32..09c93d1344 100644 --- a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/LivePanelState.java +++ b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/LivePanelState.java @@ -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) { diff --git a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/NanoleafLayout.java b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/NanoleafLayout.java index 782383dbfe..ed7c288248 100644 --- a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/NanoleafLayout.java +++ b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/layout/NanoleafLayout.java @@ -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 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[] {}; } diff --git a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/SecurityCapability.java b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/SecurityCapability.java index 255c7754f9..ac0a9b0b3c 100644 --- a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/SecurityCapability.java +++ b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/SecurityCapability.java @@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory; */ @NonNullByDefault class SecurityCapability extends RestCapability { - 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); diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocolStates.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocolStates.java index bbb7448bda..a409863e87 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocolStates.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocolStates.java @@ -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); diff --git a/bundles/org.openhab.binding.paradoxalarm/src/test/java/org/openhab/binding/paradoxalarm/internal/TestGetBytes.java b/bundles/org.openhab.binding.paradoxalarm/src/test/java/org/openhab/binding/paradoxalarm/internal/TestGetBytes.java index 3ccf9b1c32..0b4993a054 100644 --- a/bundles/org.openhab.binding.paradoxalarm/src/test/java/org/openhab/binding/paradoxalarm/internal/TestGetBytes.java +++ b/bundles/org.openhab.binding.paradoxalarm/src/test/java/org/openhab/binding/paradoxalarm/internal/TestGetBytes.java @@ -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, diff --git a/bundles/org.openhab.binding.pulseaudio/src/main/java/org/openhab/binding/pulseaudio/internal/ConvertedInputStream.java b/bundles/org.openhab.binding.pulseaudio/src/main/java/org/openhab/binding/pulseaudio/internal/ConvertedInputStream.java index 4a438fa6dc..2a59dea603 100644 --- a/bundles/org.openhab.binding.pulseaudio/src/main/java/org/openhab/binding/pulseaudio/internal/ConvertedInputStream.java +++ b/bundles/org.openhab.binding.pulseaudio/src/main/java/org/openhab/binding/pulseaudio/internal/ConvertedInputStream.java @@ -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(); diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeApi.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeApi.java index 20b8c15289..f21858bd40 100644 --- a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeApi.java +++ b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeApi.java @@ -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)); diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api2/ShellyBluApi.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api2/ShellyBluApi.java index 1ef791d311..e9cec23588 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api2/ShellyBluApi.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api2/ShellyBluApi.java @@ -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; diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBluSensorHandler.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBluSensorHandler.java index 7c98243e49..645a9a5fbf 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBluSensorHandler.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBluSensorHandler.java @@ -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); diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeAnswer.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeAnswer.java index 45c4671fcc..6bf2ae3d2d 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeAnswer.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeAnswer.java @@ -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. diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeRequest.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeRequest.java index 17f6e16e77..cb2baf6730 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeRequest.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeRequest.java @@ -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() diff --git a/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiMeasureType.java b/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiMeasureType.java index ff175cb4fe..398638cf8a 100644 --- a/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiMeasureType.java +++ b/bundles/org.openhab.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiMeasureType.java @@ -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; } } diff --git a/bundles/org.openhab.binding.touchwand/src/main/java/org/openhab/binding/touchwand/internal/dto/TouchWandUnitFromJson.java b/bundles/org.openhab.binding.touchwand/src/main/java/org/openhab/binding/touchwand/internal/dto/TouchWandUnitFromJson.java index a6635208f6..d797fa95ad 100644 --- a/bundles/org.openhab.binding.touchwand/src/main/java/org/openhab/binding/touchwand/internal/dto/TouchWandUnitFromJson.java +++ b/bundles/org.openhab.binding.touchwand/src/main/java/org/openhab/binding/touchwand/internal/dto/TouchWandUnitFromJson.java @@ -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; diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/StatusResource.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/StatusResource.java index 2449abd6f7..cccb4377bb 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/StatusResource.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/StatusResource.java @@ -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; } } diff --git a/bundles/org.openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/NotificationAction.java b/bundles/org.openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/NotificationAction.java index 17027c9e51..f47b919755 100644 --- a/bundles/org.openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/NotificationAction.java +++ b/bundles/org.openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/NotificationAction.java @@ -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); diff --git a/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java b/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java index 5b96dec869..55f39ccf1b 100644 --- a/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java +++ b/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java @@ -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)); } diff --git a/bundles/org.openhab.persistence.jpa/src/main/java/org/openhab/persistence/jpa/internal/JpaHistoricItem.java b/bundles/org.openhab.persistence.jpa/src/main/java/org/openhab/persistence/jpa/internal/JpaHistoricItem.java index ec7f7d8a12..3752661b5e 100644 --- a/bundles/org.openhab.persistence.jpa/src/main/java/org/openhab/persistence/jpa/internal/JpaHistoricItem.java +++ b/bundles/org.openhab.persistence.jpa/src/main/java/org/openhab/persistence/jpa/internal/JpaHistoricItem.java @@ -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; } diff --git a/bundles/org.openhab.persistence.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java b/bundles/org.openhab.persistence.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java index eaca9697b6..cc3bc3771e 100644 --- a/bundles/org.openhab.persistence.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java +++ b/bundles/org.openhab.persistence.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java @@ -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"); }