[multiple] Reduce SAT warnings (#17564)

* NoEmptyLineSeparatorCheck
* ModifierOrderCheck
* TypeNameCheck
* ConstantNameCheck loggers
* UnusedPrivateField
* Fix imports
* New line
* dynamodb static logger

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
lsiepel 2024-10-19 16:59:52 +02:00 committed by Ciprian Pascu
parent f22d3264c0
commit b64a37ea06
32 changed files with 105 additions and 110 deletions

View 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) { public static ThingBuilder updateThingWithConfigurationChannels(Thing thing, ThingBuilder builder) {
for (ConfigurationChannel channel : CHANNELS) { for (ConfigurationChannel channel : CHANNELS) {
@ -72,7 +72,7 @@ public class DynamicChannelHelper {
ConfigurationChannel toAdd) { ConfigurationChannel toAdd) {
ChannelUID channelId = new ChannelUID(originalThing.getUID(), toAdd.id); ChannelUID channelId = new ChannelUID(originalThing.getUID(), toAdd.id);
if (originalThing.getChannel(channelId) == null) { 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); ChannelTypeUID typeId = new ChannelTypeUID(BINDING_ID, toAdd.typeId);
Channel channel = ChannelBuilder.create(channelId, toAdd.itemType).withType(typeId).build(); Channel channel = ChannelBuilder.create(channelId, toAdd.itemType).withType(typeId).build();
builder.withChannel(channel); builder.withChannel(channel);

View File

@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public class MadokaMessage { 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 int messageId;
private final Map<Integer, MadokaValue> values; private final Map<Integer, MadokaValue> values;
@ -93,7 +93,7 @@ public class MadokaMessage {
return chunks; return chunks;
} catch (IOException e) { } catch (IOException e) {
logger.info("Error while building request", e); LOGGER.info("Error while building request", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }

View File

@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public class BluetoothChannelUtils { 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) { public static String encodeFieldID(Field field) {
String requirements = Optional.ofNullable(field.getRequirements()).orElse(Collections.emptyList()).stream() String requirements = Optional.ofNullable(field.getRequirements()).orElse(Collections.emptyList()).stream()
@ -130,7 +130,7 @@ public class BluetoothChannelUtils {
if (fieldType == FieldType.BOOLEAN) { if (fieldType == FieldType.BOOLEAN) {
OnOffType onOffType = convert(state, OnOffType.class); OnOffType onOffType = convert(state, OnOffType.class);
if (onOffType == null) { 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); fieldName, state);
return; return;
} }
@ -144,7 +144,7 @@ public class BluetoothChannelUtils {
request.setField(fieldName, enumeration); request.setField(fieldName, enumeration);
return; return;
} else { } else {
logger.debug("Could not convert state to enumeration: {} : {} : {} ", request.getCharacteristicUUID(), LOGGER.debug("Could not convert state to enumeration: {} : {} : {} ", request.getCharacteristicUUID(),
fieldName, state); fieldName, state);
} }
// fall back to simple types // fall back to simple types
@ -154,7 +154,7 @@ public class BluetoothChannelUtils {
case SINT: { case SINT: {
DecimalType decimalType = convert(state, DecimalType.class); DecimalType decimalType = convert(state, DecimalType.class);
if (decimalType == null) { if (decimalType == null) {
logger.debug("Could not convert state to DecimalType: {} : {} : {} ", LOGGER.debug("Could not convert state to DecimalType: {} : {} : {} ",
request.getCharacteristicUUID(), fieldName, state); request.getCharacteristicUUID(), fieldName, state);
return; return;
} }
@ -165,7 +165,7 @@ public class BluetoothChannelUtils {
case FLOAT_IEE11073: { case FLOAT_IEE11073: {
DecimalType decimalType = convert(state, DecimalType.class); DecimalType decimalType = convert(state, DecimalType.class);
if (decimalType == null) { if (decimalType == null) {
logger.debug("Could not convert state to DecimalType: {} : {} : {} ", LOGGER.debug("Could not convert state to DecimalType: {} : {} : {} ",
request.getCharacteristicUUID(), fieldName, state); request.getCharacteristicUUID(), fieldName, state);
return; return;
} }
@ -176,7 +176,7 @@ public class BluetoothChannelUtils {
case UTF16S: { case UTF16S: {
StringType textType = convert(state, StringType.class); StringType textType = convert(state, StringType.class);
if (textType == null) { if (textType == null) {
logger.debug("Could not convert state to StringType: {} : {} : {} ", LOGGER.debug("Could not convert state to StringType: {} : {} : {} ",
request.getCharacteristicUUID(), fieldName, state); request.getCharacteristicUUID(), fieldName, state);
return; return;
} }
@ -186,7 +186,7 @@ public class BluetoothChannelUtils {
case STRUCT: case STRUCT:
StringType textType = convert(state, StringType.class); StringType textType = convert(state, StringType.class);
if (textType == null) { if (textType == null) {
logger.debug("Could not convert state to StringType: {} : {} : {} ", LOGGER.debug("Could not convert state to StringType: {} : {} : {} ",
request.getCharacteristicUUID(), fieldName, state); request.getCharacteristicUUID(), fieldName, state);
return; return;
} }

View File

@ -44,7 +44,7 @@ public enum GoveeModel {
private final String label; private final String label;
private final boolean supportsWarningBroadcast; 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) { private GoveeModel(ThingTypeUID thingTypeUID, String label, boolean supportsWarningBroadcast) {
this.thingTypeUID = thingTypeUID; this.thingTypeUID = thingTypeUID;
@ -71,13 +71,13 @@ public enum GoveeModel {
String uname = name.toUpperCase(); String uname = name.toUpperCase();
for (GoveeModel model : GoveeModel.values()) { for (GoveeModel model : GoveeModel.values()) {
if (uname.contains(model.name())) { if (uname.contains(model.name())) {
logger.debug("detected model {}", model); LOGGER.debug("detected model {}", model);
return model; return model;
} }
} }
} }
} }
logger.debug("Device {} is no Govee", name); LOGGER.debug("Device {} is no Govee", name);
return null; return null;
} }
} }

View File

@ -34,14 +34,14 @@ public class RadoneyeDataParser {
private static final int EXPECTED_DATA_LEN_V2 = 12; private static final int EXPECTED_DATA_LEN_V2 = 12;
private static final int EXPECTED_VER_PLUS = 1; 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() { private RadoneyeDataParser() {
} }
public static Map<String, Number> parseRd200Data(int fwVersion, int[] data) throws RadoneyeParserException { public static Map<String, Number> parseRd200Data(int fwVersion, int[] data) throws RadoneyeParserException {
logger.debug("Parsed data length: {}", data.length); LOGGER.debug("Parsed data length: {}", data.length);
logger.debug("Parsed data: {}", data); LOGGER.debug("Parsed data: {}", data);
final Map<String, Number> result = new HashMap<>(); final Map<String, Number> result = new HashMap<>();

View File

@ -241,7 +241,6 @@ public abstract class DaikinBaseHandler extends BaseThingHandler {
return false; return false;
} }
boolean changeModeSuccess = false;
updateState(DaikinBindingConstants.CHANNEL_AC_POWER, OnOffType.from(power)); updateState(DaikinBindingConstants.CHANNEL_AC_POWER, OnOffType.from(power));
String newMode = switch (mode) { String newMode = switch (mode) {

View File

@ -226,7 +226,6 @@ public class EmotivaProcessorHandler extends BaseThingHandler {
private void startPollingKeepAlive() { private void startPollingKeepAlive() {
final ScheduledFuture<?> localRefreshJob = this.pollingJob; final ScheduledFuture<?> localRefreshJob = this.pollingJob;
if (localRefreshJob == null || localRefreshJob.isCancelled()) { if (localRefreshJob == null || localRefreshJob.isCancelled()) {
Number keepAliveConfig = state.getChannel(EmotivaSubscriptionTags.keepAlive) Number keepAliveConfig = state.getChannel(EmotivaSubscriptionTags.keepAlive)
.filter(channel -> channel instanceof Number).map(keepAlive -> (Number) keepAlive) .filter(channel -> channel instanceof Number).map(keepAlive -> (Number) keepAlive)
.orElse(new DecimalType(config.keepAlive)); .orElse(new DecimalType(config.keepAlive));

View File

@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public class EEPFactory { 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) { public static EEP createEEP(EEPType eepType) {
try { try {
@ -70,7 +70,7 @@ public class EEPFactory {
return cl.getConstructor(ERP1Message.class).newInstance(packet); return cl.getConstructor(ERP1Message.class).newInstance(packet);
} catch (IllegalAccessException | InstantiationException | IllegalArgumentException | InvocationTargetException } catch (IllegalAccessException | InstantiationException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) { | NoSuchMethodException | SecurityException e) {
logger.error("Cannot instantiate EEP {}-{}-{}: {}", LOGGER.error("Cannot instantiate EEP {}-{}-{}: {}",
HexUtils.bytesToHex(new byte[] { eepType.getRORG().getValue() }), HexUtils.bytesToHex(new byte[] { eepType.getRORG().getValue() }),
HexUtils.bytesToHex(new byte[] { (byte) eepType.getFunc() }), HexUtils.bytesToHex(new byte[] { (byte) eepType.getFunc() }),
HexUtils.bytesToHex(new byte[] { (byte) eepType.getType() }), e.getMessage()); HexUtils.bytesToHex(new byte[] { (byte) eepType.getType() }), e.getMessage());
@ -80,16 +80,16 @@ public class EEPFactory {
} }
private static @Nullable EEPType getGenericEEPTypeFor(byte rorg) { 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); RORG r = RORG.getRORG(rorg);
if (r == RORG._4BS) { if (r == RORG._4BS) {
logger.info("Fallback to 4BS generic thing"); LOGGER.info("Fallback to 4BS generic thing");
return EEPType.Generic4BS; return EEPType.Generic4BS;
} else if (r == RORG.VLD) { } else if (r == RORG.VLD) {
logger.info("Fallback to VLD generic thing"); LOGGER.info("Fallback to VLD generic thing");
return EEPType.GenericVLD; return EEPType.GenericVLD;
} else { } else {
logger.info("Fallback not possible"); LOGGER.info("Fallback not possible");
return null; return null;
} }
} }
@ -155,7 +155,7 @@ public class EEPFactory {
case _4BS: { case _4BS: {
int db0 = msg.getPayload()[4]; int db0 = msg.getPayload()[4];
if ((db0 & _4BSMessage.LRN_TYPE_MASK) == 0) { // Variation 1 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); return buildEEP(EEPType.Generic4BS, msg);
} }
@ -167,7 +167,7 @@ public class EEPFactory {
int type = ((db3 & 0b11) << 5) + ((db2 & 0xFF) >>> 3); int type = ((db3 & 0b11) << 5) + ((db2 & 0xFF) >>> 3);
int manufId = ((db2 & 0b111) << 8) + (db1 & 0xff); 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) func }),
HexUtils.bytesToHex(new byte[] { (byte) type }), HexUtils.bytesToHex(new byte[] { (byte) type }),
HexUtils.bytesToHex(new byte[] { (byte) manufId })); HexUtils.bytesToHex(new byte[] { (byte) manufId }));
@ -229,7 +229,7 @@ public class EEPFactory {
byte[] senderId = Arrays.copyOfRange(payload, 12, 12 + 4); 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) rorg }), HexUtils.bytesToHex(new byte[] { (byte) func }),
HexUtils.bytesToHex(new byte[] { (byte) type }), HexUtils.bytesToHex(new byte[] { (byte) manufId })); HexUtils.bytesToHex(new byte[] { (byte) type }), HexUtils.bytesToHex(new byte[] { (byte) manufId }));
@ -263,22 +263,22 @@ public class EEPFactory {
byte priority = event.getPayload()[1]; byte priority = event.getPayload()[1];
if ((priority & 0b1001) == 0b1001) { if ((priority & 0b1001) == 0b1001) {
logger.debug("gtw is already postmaster"); LOGGER.debug("gtw is already postmaster");
if (sendTeachOuts) { 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(); response.setTeachOutResponse();
} else { } else {
logger.debug("Send a repeated learn in"); LOGGER.debug("Send a repeated learn in");
response.setRepeatedTeachInResponse(); response.setRepeatedTeachInResponse();
} }
} else if ((priority & 0b100) == 0) { } else if ((priority & 0b100) == 0) {
logger.debug("no place for further mailbox"); LOGGER.debug("no place for further mailbox");
response.setNoPlaceForFurtherMailbox(); response.setNoPlaceForFurtherMailbox();
} else if ((priority & 0b10) == 0) { } else if ((priority & 0b10) == 0) {
logger.debug("rssi is not good enough"); LOGGER.debug("rssi is not good enough");
response.setBadRSSI(); response.setBadRSSI();
} else if ((priority & 0b1) == 0b1) { } 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(); response.setTeachIn();
} }

View File

@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
*/ */
@NonNullByDefault @NonNullByDefault
public abstract class EEPHelper { 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) { public static State validateTotalUsage(State value, @Nullable State currentState, Configuration config) {
EnOceanChannelTotalusageConfig c = config.as(EnOceanChannelTotalusageConfig.class); EnOceanChannelTotalusageConfig c = config.as(EnOceanChannelTotalusageConfig.class);
@ -71,10 +71,10 @@ public abstract class EEPHelper {
public static boolean validateUnscaledValue(int unscaledValue, double unscaledMin, double unscaledMax) { public static boolean validateUnscaledValue(int unscaledValue, double unscaledMin, double unscaledMax) {
if (unscaledValue < unscaledMin) { 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; return false;
} else if (unscaledValue > unscaledMax) { } 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; return false;
} }

View File

@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
*/ */
@NonNullByDefault @NonNullByDefault
public class FroniusHttpUtil { 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. * Issue a HTTP request and retry on failure.
@ -82,17 +82,17 @@ public class FroniusHttpUtil {
if (result != null) { if (result != null) {
if (attemptCount > 1) { if (attemptCount > 1) {
logger.debug("Attempt #{} successful {}", attemptCount, url); LOGGER.debug("Attempt #{} successful {}", attemptCount, url);
} }
return result; return result;
} }
if (attemptCount >= 3) { 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); 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); Thread.sleep(500 * attemptCount);
attemptCount++; attemptCount++;
} }

View File

@ -21,7 +21,7 @@ import com.google.gson.annotations.SerializedName;
* @author Christian Feininger - Initial contribution * @author Christian Feininger - Initial contribution
*/ */
public class HaasSohnpelletstoveJsonDataDTO { public class HaasSohnpelletstoveJsonDataDTO {
metadata meta = new metadata(); Metadata meta = new Metadata();
boolean prg; boolean prg;
boolean wprg; boolean wprg;
String mode = ""; String mode = "";
@ -32,9 +32,9 @@ public class HaasSohnpelletstoveJsonDataDTO {
@SerializedName("ht_char") @SerializedName("ht_char")
String htChar = ""; String htChar = "";
@SerializedName("weekprogram") @SerializedName("weekprogram")
private wprogram[] weekprogram; private Wprogram[] weekprogram;
@SerializedName("error") @SerializedName("error")
private err[] error; private Err[] error;
@SerializedName("eco_mode") @SerializedName("eco_mode")
boolean ecoMode; boolean ecoMode;
boolean pgi; boolean pgi;
@ -98,7 +98,7 @@ public class HaasSohnpelletstoveJsonDataDTO {
return this; return this;
} }
public class metadata { public class Metadata {
@SerializedName("sw_version") @SerializedName("sw_version")
String swVersion = ""; String swVersion = "";
@SerializedName("hw_version") @SerializedName("hw_version")
@ -119,19 +119,19 @@ public class HaasSohnpelletstoveJsonDataDTO {
String ean = ""; String ean = "";
boolean rau; boolean rau;
@SerializedName("wlan_features") @SerializedName("wlan_features")
private String[] wlan_features; private String[] wlanFeatures;
public String getNonce() { public String getNonce() {
return nonce; return nonce;
} }
} }
public class err { public class Err {
String time = ""; String time = "";
String nr = ""; String nr = "";
} }
public class wprogram { public class Wprogram {
String day = ""; String day = "";
String begin = ""; String begin = "";
String end = ""; String end = "";

View File

@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public class HeosActions implements ThingActions { 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; private @Nullable HeosBridgeHandler handler;

View File

@ -56,7 +56,7 @@ public class CommandTag {
private static final List<Class<? extends Command>> percentCommandType = Arrays.asList(PercentType.class); 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 String inputLine;
private CommandTagType tagType; private CommandTagType tagType;
@ -150,15 +150,15 @@ public class CommandTag {
public static @Nullable CommandTag createCommandTag(String inputLine) { public static @Nullable CommandTag createCommandTag(String inputLine) {
if (inputLine.isEmpty() || !CommandTagType.prefixValid(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; return null;
} }
try { try {
final CommandTag tag = new CommandTag(inputLine); 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; return tag;
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
logger.warn("{}", e.getMessage()); LOGGER.warn("{}", e.getMessage());
return null; return null;
} }
} }

View File

@ -41,7 +41,7 @@ import fi.tkgwf.ruuvi.common.parser.impl.AnyDataFormatParser;
@NonNullByDefault @NonNullByDefault
public class GatewayPayloadParser { 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 Gson GSON = new GsonBuilder().create();
private static final AnyDataFormatParser parser = new AnyDataFormatParser(); private static final AnyDataFormatParser parser = new AnyDataFormatParser();
private static final Predicate<String> HEX_PATTERN_CHECKER = Pattern.compile("^([0-9A-Fa-f]{2})+$") 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 { private GatewayPayload(GatewayPayloadIntermediate intermediate) throws IllegalArgumentException {
String gwMac = intermediate.gw_mac; String gwMac = intermediate.gw_mac;
if (gwMac == null) { if (gwMac == null) {
logger.trace("Missing mandatory field 'gw_mac', ignoring"); LOGGER.trace("Missing mandatory field 'gw_mac', ignoring");
} }
this.gwMac = Optional.ofNullable(gwMac); this.gwMac = Optional.ofNullable(gwMac);
rssi = intermediate.rssi; rssi = intermediate.rssi;
try { try {
gwts = Optional.of(Instant.ofEpochSecond(intermediate.gwts)); gwts = Optional.of(Instant.ofEpochSecond(intermediate.gwts));
} catch (DateTimeException e) { } 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 { try {
ts = Optional.of(Instant.ofEpochSecond(intermediate.ts)); ts = Optional.of(Instant.ofEpochSecond(intermediate.ts));
} catch (DateTimeException e) { } 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; String localData = intermediate.data;
@ -101,7 +101,7 @@ public class GatewayPayloadParser {
} }
if (!HEX_PATTERN_CHECKER.test(localData)) { if (!HEX_PATTERN_CHECKER.test(localData)) {
logger.debug( LOGGER.debug(
"Data is not representing manufacturer specific bluetooth advertisement, it is not valid hex: {}", "Data is not representing manufacturer specific bluetooth advertisement, it is not valid hex: {}",
localData); localData);
throw new IllegalArgumentException( throw new IllegalArgumentException(
@ -116,7 +116,7 @@ public class GatewayPayloadParser {
throw new IllegalArgumentException("Manufacturerer data is too short"); throw new IllegalArgumentException("Manufacturerer data is too short");
} }
if ((bytes[4] & 0xff) != 0xff) { 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)); HexUtils.bytesToHex(bytes));
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Data is not representing manufacturer specific bluetooth advertisement"); "Data is not representing manufacturer specific bluetooth advertisement");
@ -125,7 +125,7 @@ public class GatewayPayloadParser {
byte[] manufacturerData = Arrays.copyOfRange(bytes, 5, bytes.length); byte[] manufacturerData = Arrays.copyOfRange(bytes, 5, bytes.length);
RuuviMeasurement localManufacturerData = parser.parse(manufacturerData); RuuviMeasurement localManufacturerData = parser.parse(manufacturerData);
if (localManufacturerData == null) { 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"); throw new IllegalArgumentException("Manufacturer data is not valid");
} }
measurement = localManufacturerData; measurement = localManufacturerData;

View File

@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public class LivePanelState implements PanelState { 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; private final NanoleafPanelColors panelColors;
public LivePanelState(NanoleafPanelColors panelColors) { public LivePanelState(NanoleafPanelColors panelColors) {

View File

@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public class NanoleafLayout { 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; private static final Color COLOR_BACKGROUND = Color.WHITE;
public static byte[] render(PanelLayout panelLayout, PanelState state, LayoutSettings settings) throws IOException { public static byte[] render(PanelLayout panelLayout, PanelState state, LayoutSettings settings) throws IOException {
@ -53,13 +53,13 @@ public class NanoleafLayout {
Layout layout = panelLayout.getLayout(); Layout layout = panelLayout.getLayout();
if (layout == null) { 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[] {}; return new byte[] {};
} }
List<PositionDatum> positionDatums = layout.getPositionData(); List<PositionDatum> positionDatums = layout.getPositionData();
if (positionDatums == null) { 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[] {}; return new byte[] {};
} }

View File

@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
*/ */
@NonNullByDefault @NonNullByDefault
class SecurityCapability extends RestCapability<SecurityApi> { 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()); ZoneId.systemDefault());
private final Logger logger = LoggerFactory.getLogger(SecurityCapability.class); private final Logger logger = LoggerFactory.getLogger(SecurityCapability.class);

View File

@ -60,7 +60,7 @@ public enum NibeHeatPumpProtocolStates implements NibeHeatPumpProtocolState {
context.msg().put(b); context.msg().put(b);
try { try {
msgStatus status = checkNibeMessage(context.msg().asReadOnlyBuffer()); MsgStatus status = checkNibeMessage(context.msg().asReadOnlyBuffer());
switch (status) { switch (status) {
case INVALID: case INVALID:
context.state(WAIT_START); context.state(WAIT_START);
@ -130,7 +130,7 @@ public enum NibeHeatPumpProtocolStates implements NibeHeatPumpProtocolState {
} }
}; };
private enum msgStatus { private enum MsgStatus {
VALID, VALID,
VALID_BUT_NOT_READY, VALID_BUT_NOT_READY,
INVALID INVALID
@ -139,13 +139,13 @@ public enum NibeHeatPumpProtocolStates implements NibeHeatPumpProtocolState {
/* /*
* Throws NibeHeatPumpException when checksum fails * Throws NibeHeatPumpException when checksum fails
*/ */
private static msgStatus checkNibeMessage(ByteBuffer byteBuffer) throws NibeHeatPumpException { private static MsgStatus checkNibeMessage(ByteBuffer byteBuffer) throws NibeHeatPumpException {
byteBuffer.flip(); byteBuffer.flip();
int len = byteBuffer.remaining(); int len = byteBuffer.remaining();
if (len >= 1) { if (len >= 1) {
if (byteBuffer.get(0) != NibeHeatPumpProtocol.FRAME_START_CHAR_RES) { if (byteBuffer.get(0) != NibeHeatPumpProtocol.FRAME_START_CHAR_RES) {
return msgStatus.INVALID; return MsgStatus.INVALID;
} }
if (len >= 6) { if (len >= 6) {
@ -153,7 +153,7 @@ public enum NibeHeatPumpProtocolStates implements NibeHeatPumpProtocolState {
// check if all bytes received // check if all bytes received
if (len < datalen + 6) { if (len < datalen + 6) {
return msgStatus.VALID_BUT_NOT_READY; return MsgStatus.VALID_BUT_NOT_READY;
} }
// calculate XOR checksum // 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); private static final Logger LOGGER = LoggerFactory.getLogger(NibeHeatPumpProtocolStates.class);

View File

@ -45,7 +45,7 @@ public class TestGetBytes {
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "TRACE"); 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, 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, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, 0x01, 0x02, 0x03,

View File

@ -76,7 +76,6 @@ public class ConvertedInputStream extends AudioStream {
if (container.equals(AudioFormat.CONTAINER_WAVE)) { if (container.equals(AudioFormat.CONTAINER_WAVE)) {
AudioWaveUtils.removeFMT(innerInputStream); AudioWaveUtils.removeFMT(innerInputStream);
} }
} else { } else {
pcmInnerInputStream = getPCMStream(new BufferedInputStream(innerInputStream)); pcmInnerInputStream = getPCMStream(new BufferedInputStream(innerInputStream));
var javaAudioFormat = ((AudioInputStream) pcmInnerInputStream).getFormat(); var javaAudioFormat = ((AudioInputStream) pcmInnerInputStream).getFormat();

View File

@ -73,7 +73,6 @@ public class SenecHomeApi {
*/ */
public SenecHomeResponse getStatistics() public SenecHomeResponse getStatistics()
throws TimeoutException, ExecutionException, IOException, InterruptedException, JsonSyntaxException { throws TimeoutException, ExecutionException, IOException, InterruptedException, JsonSyntaxException {
String dataToSend = gson.toJson(new SenecHomeResponse()); String dataToSend = gson.toJson(new SenecHomeResponse());
ContentResponse response = postRequest(dataToSend); ContentResponse response = postRequest(dataToSend);
return Objects.requireNonNull(gson.fromJson(response.getContentAsString(), SenecHomeResponse.class)); return Objects.requireNonNull(gson.fromJson(response.getContentAsString(), SenecHomeResponse.class));

View File

@ -54,7 +54,7 @@ import org.slf4j.LoggerFactory;
*/ */
@NonNullByDefault @NonNullByDefault
public class ShellyBluApi extends Shelly2ApiRpc { 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 boolean connected = false; // true = BLU devices has connected
private ShellySettingsStatus deviceStatus = new ShellySettingsStatus(); private ShellySettingsStatus deviceStatus = new ShellySettingsStatus();
private int lastPid = -1; private int lastPid = -1;

View File

@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
*/ */
@NonNullByDefault @NonNullByDefault
public class ShellyBluSensorHandler extends ShellyBaseHandler { 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, public ShellyBluSensorHandler(final Thing thing, final ShellyTranslationProvider translationProvider,
final ShellyBindingConfiguration bindingConfig, final ShellyThingTable thingTable, final ShellyBindingConfiguration bindingConfig, final ShellyThingTable thingTable,
@ -50,7 +50,7 @@ public class ShellyBluSensorHandler extends ShellyBaseHandler {
@Override @Override
public void initialize() { public void initialize() {
logger.debug("Thing is using {}", this.getClass()); LOGGER.debug("Thing is using {}", this.getClass());
super.initialize(); super.initialize();
} }
@ -58,7 +58,7 @@ public class ShellyBluSensorHandler extends ShellyBaseHandler {
String model = substringBefore(getString(e.data.name), "-").toUpperCase(); String model = substringBefore(getString(e.data.name), "-").toUpperCase();
String mac = e.data.addr.replaceAll(":", ""); String mac = e.data.addr.replaceAll(":", "");
String ttype = ""; 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; ThingTypeUID tuid;
switch (model) { switch (model) {
case SHELLYDT_BLUBUTTON: case SHELLYDT_BLUBUTTON:
@ -78,7 +78,7 @@ public class ShellyBluSensorHandler extends ShellyBaseHandler {
tuid = THING_TYPE_SHELLYBLUHT; tuid = THING_TYPE_SHELLYBLUHT;
break; break;
default: default:
logger.debug("{}: Unsupported BLU device model {}, MAC={}", gateway, model, mac); LOGGER.debug("{}: Unsupported BLU device model {}, MAC={}", gateway, model, mac);
return; return;
} }
String serviceName = ShellyDeviceProfile.buildBluServiceName(getString(e.data.name), mac); String serviceName = ShellyDeviceProfile.buildBluServiceName(getString(e.data.name), mac);

View File

@ -29,8 +29,7 @@ import org.slf4j.LoggerFactory;
*/ */
public abstract class SinopeAnswer extends SinopeRequest { public abstract class SinopeAnswer extends SinopeRequest {
/** The Constant logger. */ private final Logger logger = LoggerFactory.getLogger(SinopeAnswer.class);
private static final Logger logger = LoggerFactory.getLogger(SinopeAnswer.class);
/** /**
* Instantiates a new sinope answer. * Instantiates a new sinope answer.

View 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 protected static final int HEADER_COMMAND_CRC_SIZE = SinopeFrame.PREAMBLE_SIZE + SinopeFrame.FRAME_CTL_SIZE
+ SinopeFrame.SIZE_SIZE + SinopeFrame.COMMAND_SIZE + SinopeFrame.CRC_SIZE; + SinopeFrame.SIZE_SIZE + SinopeFrame.COMMAND_SIZE + SinopeFrame.CRC_SIZE;
/** The Constant logger. */ private final Logger logger = LoggerFactory.getLogger(SinopeRequest.class);
private static final Logger logger = LoggerFactory.getLogger(SinopeRequest.class);
/** /**
* @see org.openhab.binding.sinope.internal.core.base.SinopeFrame#getPayload() * @see org.openhab.binding.sinope.internal.core.base.SinopeFrame#getPayload()

View File

@ -55,7 +55,7 @@ public enum TACmiMeasureType {
private final int typeval; private final int typeval;
private final int offset; 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) { private TACmiMeasureType(int typeval, int offset) {
this.typeval = typeval; this.typeval = typeval;
@ -79,7 +79,7 @@ public enum TACmiMeasureType {
return mtype; return mtype;
} }
} }
logger.debug("Received unexpected measure type {}", type); LOGGER.debug("Received unexpected measure type {}", type);
return TACmiMeasureType.UNSUPPORTED; return TACmiMeasureType.UNSUPPORTED;
} }
} }

View File

@ -34,7 +34,7 @@ import com.google.gson.JsonParser;
@NonNullByDefault @NonNullByDefault
public class TouchWandUnitFromJson { public class TouchWandUnitFromJson {
private static final Logger logger = LoggerFactory.getLogger(TouchWandUnitFromJson.class); private static final Logger LOGGER = LoggerFactory.getLogger(TouchWandUnitFromJson.class);
public TouchWandUnitFromJson() { public TouchWandUnitFromJson() {
} }
@ -93,7 +93,7 @@ public class TouchWandUnitFromJson {
unitObj = JsonParser.parseString(JsonUnit).getAsJsonObject(); unitObj = JsonParser.parseString(JsonUnit).getAsJsonObject();
myTouchWandUnitData = parseResponse(unitObj); myTouchWandUnitData = parseResponse(unitObj);
} catch (JsonParseException | IllegalStateException e) { } catch (JsonParseException | IllegalStateException e) {
logger.warn("Could not parse response {}", JsonUnit); LOGGER.warn("Could not parse response {}", JsonUnit);
myTouchWandUnitData = new TouchWandUnknownTypeUnitData(); // Return unknown type myTouchWandUnitData = new TouchWandUnknownTypeUnitData(); // Return unknown type
} }
return myTouchWandUnitData; return myTouchWandUnitData;

View File

@ -66,7 +66,7 @@ public class StatusResource implements RegistryListener {
@Reference @Reference
protected @NonNullByDefault({}) UpnpService upnpService; protected @NonNullByDefault({}) UpnpService upnpService;
private enum upnpStatus { private enum UpnpStatus {
service_not_registered, service_not_registered,
service_registered_but_no_UPnP_traffic_yet, service_registered_but_no_UPnP_traffic_yet,
upnp_announcement_thread_not_running, upnp_announcement_thread_not_running,
@ -74,7 +74,7 @@ public class StatusResource implements RegistryListener {
success success
} }
private upnpStatus selfTestUpnpFound = upnpStatus.service_not_registered; private UpnpStatus selfTestUpnpFound = UpnpStatus.service_not_registered;
private final Logger logger = LoggerFactory.getLogger(StatusResource.class); private final Logger logger = LoggerFactory.getLogger(StatusResource.class);
@ -89,7 +89,7 @@ public class StatusResource implements RegistryListener {
return; return;
} }
selfTestUpnpFound = upnpStatus.service_registered_but_no_UPnP_traffic_yet; selfTestUpnpFound = UpnpStatus.service_registered_but_no_UPnP_traffic_yet;
for (RemoteDevice device : registry.getRemoteDevices()) { for (RemoteDevice device : registry.getRemoteDevices()) {
remoteDeviceAdded(registry, device); remoteDeviceAdded(registry, device);
@ -171,7 +171,7 @@ public class StatusResource implements RegistryListener {
} }
if (!localDiscovery.upnpAnnouncementThreadRunning()) { 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", return String.format(format, cs.ds.config.linkbutton ? "On" : "Off",
@ -194,7 +194,7 @@ public class StatusResource implements RegistryListener {
@NonNullByDefault({}) @NonNullByDefault({})
@Override @Override
public void remoteDeviceAdded(Registry registry, RemoteDevice device) { public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
if (selfTestUpnpFound == upnpStatus.success) { if (selfTestUpnpFound == UpnpStatus.success) {
return; return;
} }
checkForDevice(getDetails(device)); checkForDevice(getDetails(device));
@ -211,10 +211,10 @@ public class StatusResource implements RegistryListener {
} }
private void checkForDevice(DeviceDetails details) { private void checkForDevice(DeviceDetails details) {
selfTestUpnpFound = upnpStatus.any_device_but_not_this_one_found; selfTestUpnpFound = UpnpStatus.any_device_but_not_this_one_found;
try { try {
if (cs.ds.config.bridgeid.equals(details.getSerialNumber())) { 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 } 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); logger.warn("upnp service: adding services failed: {}", details.getFriendlyName(), e);
@ -230,14 +230,14 @@ public class StatusResource implements RegistryListener {
@Override @Override
public void remoteDeviceRemoved(Registry registry, RemoteDevice device) { public void remoteDeviceRemoved(Registry registry, RemoteDevice device) {
UpnpServer localDiscovery = discovery; UpnpServer localDiscovery = discovery;
if (selfTestUpnpFound != upnpStatus.success || localDiscovery == null if (selfTestUpnpFound != UpnpStatus.success || localDiscovery == null
|| localDiscovery.upnpAnnouncementThreadRunning()) { || localDiscovery.upnpAnnouncementThreadRunning()) {
return; return;
} }
DeviceDetails details = getDetails(device); DeviceDetails details = getDetails(device);
String serialNo = details.getSerialNumber(); String serialNo = details.getSerialNumber();
if (cs.ds.config.bridgeid.equals(serialNo)) { 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 @Override
public void localDeviceAdded(Registry registry, LocalDevice device) { public void localDeviceAdded(Registry registry, LocalDevice device) {
UpnpServer localDiscovery = discovery; UpnpServer localDiscovery = discovery;
if (selfTestUpnpFound == upnpStatus.success || localDiscovery == null if (selfTestUpnpFound == UpnpStatus.success || localDiscovery == null
|| localDiscovery.upnpAnnouncementThreadRunning()) { || localDiscovery.upnpAnnouncementThreadRunning()) {
return; return;
} }
@ -264,6 +264,6 @@ public class StatusResource implements RegistryListener {
@Override @Override
public void afterShutdown() { public void afterShutdown() {
selfTestUpnpFound = upnpStatus.service_not_registered; selfTestUpnpFound = UpnpStatus.service_not_registered;
} }
} }

View File

@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public class NotificationAction { 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; public static @Nullable CloudService cloudService;
@ -81,7 +81,7 @@ public class NotificationAction {
@Nullable String title, @Nullable String referenceId, @Nullable String onClickAction, @Nullable String title, @Nullable String referenceId, @Nullable String onClickAction,
@Nullable String mediaAttachmentUrl, @Nullable String actionButton1, @Nullable String actionButton2, @Nullable String mediaAttachmentUrl, @Nullable String actionButton1, @Nullable String actionButton2,
@Nullable String actionButton3) { @Nullable String actionButton3) {
logger.debug("sending notification '{}' to user {}", message, userId); LOGGER.debug("sending notification '{}' to user {}", message, userId);
if (cloudService != null) { if (cloudService != null) {
cloudService.sendNotification(userId, message, icon, tag, title, referenceId, onClickAction, cloudService.sendNotification(userId, message, icon, tag, title, referenceId, onClickAction,
mediaAttachmentUrl, actionButton1, actionButton2, actionButton3); 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") @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) { 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) { if (cloudService != null) {
cloudService.sendLogNotification(message, icon, tag); cloudService.sendLogNotification(message, icon, tag);
} }
@ -164,7 +164,7 @@ public class NotificationAction {
@Nullable String title, @Nullable String referenceId, @Nullable String onClickAction, @Nullable String title, @Nullable String referenceId, @Nullable String onClickAction,
@Nullable String mediaAttachmentUrl, @Nullable String actionButton1, @Nullable String actionButton2, @Nullable String mediaAttachmentUrl, @Nullable String actionButton1, @Nullable String actionButton2,
@Nullable String actionButton3) { @Nullable String actionButton3) {
logger.debug("sending broadcast notification '{}' to all users", message); LOGGER.debug("sending broadcast notification '{}' to all users", message);
if (cloudService != null) { if (cloudService != null) {
cloudService.sendBroadcastNotification(message, icon, tag, title, referenceId, onClickAction, cloudService.sendBroadcastNotification(message, icon, tag, title, referenceId, onClickAction,
mediaAttachmentUrl, actionButton1, actionButton2, actionButton3); mediaAttachmentUrl, actionButton1, actionButton2, actionButton3);

View File

@ -108,7 +108,7 @@ public class DynamoDBPersistenceService implements QueryablePersistenceService {
private final UnitProvider unitProvider; private final UnitProvider unitProvider;
private @Nullable DynamoDbEnhancedAsyncClient client; private @Nullable DynamoDbEnhancedAsyncClient client;
private @Nullable DynamoDbAsyncClient lowLevelClient; 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 boolean isProperlyConfigured;
private @Nullable DynamoDBConfig dbConfig; private @Nullable DynamoDBConfig dbConfig;
private @Nullable DynamoDBTableNameResolver tableNameResolver; private @Nullable DynamoDBTableNameResolver tableNameResolver;
@ -645,7 +645,8 @@ public class DynamoDBPersistenceService implements QueryablePersistenceService {
if (itemUnit != null) { if (itemUnit != null) {
State convertedState = type.toUnit(itemUnit); State convertedState = type.toUnit(itemUnit);
if (convertedState == null) { 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( throw new IllegalArgumentException(
String.format("Unexpected unit conversion failure: %s to item unit %s", state, itemUnit)); String.format("Unexpected unit conversion failure: %s to item unit %s", state, itemUnit));
} }

View File

@ -57,7 +57,7 @@ import org.slf4j.LoggerFactory;
*/ */
@NonNullByDefault @NonNullByDefault
public class JpaHistoricItem implements HistoricItem { 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 String name;
private final State state; private final State state;
@ -123,7 +123,7 @@ public class JpaHistoricItem implements HistoricItem {
// Ensure we return in the item's unit // Ensure we return in the item's unit
state = value.toUnit(unit); state = value.toUnit(unit);
if (state == null) { 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); item.getName(), unit);
return null; return null;
} }

View File

@ -115,7 +115,7 @@ public class MongoDBTypeConversions {
return STATE_CONVERTERS.getOrDefault(state.getClass(), State::toString).apply(state); 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. * A map of converters that convert openHAB states to MongoDB compatible types.
@ -199,7 +199,7 @@ public class MongoDBTypeConversions {
if (value instanceof String) { if (value instanceof String) {
return new HSBType(value.toString()); return new HSBType(value.toString());
} else { } 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); value);
return new HSBType("0,0,0"); return new HSBType("0,0,0");
} }
@ -249,7 +249,7 @@ public class MongoDBTypeConversions {
Binary data = fieldValue.get(MongoDBFields.FIELD_VALUE_DATA, Binary.class); Binary data = fieldValue.get(MongoDBFields.FIELD_VALUE_DATA, Binary.class);
return new RawType(data.getData(), type); return new RawType(data.getData(), type);
} else { } 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); value);
return new RawType(new byte[0], "application/octet-stream"); return new RawType(new byte[0], "application/octet-stream");
} }