[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) {
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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
*/
@NonNullByDefault
public abstract class EEPHelper {
private static final Logger logger = LoggerFactory.getLogger(EEPHelper.class);
private static final Logger LOGGER = LoggerFactory.getLogger(EEPHelper.class);
public static State validateTotalUsage(State value, @Nullable State currentState, Configuration config) {
EnOceanChannelTotalusageConfig c = config.as(EnOceanChannelTotalusageConfig.class);
@ -71,10 +71,10 @@ public abstract class EEPHelper {
public static boolean validateUnscaledValue(int unscaledValue, double unscaledMin, double unscaledMax) {
if (unscaledValue < unscaledMin) {
logger.debug("Unscaled value ({}) lower than the minimum allowed ({})", unscaledValue, unscaledMin);
LOGGER.debug("Unscaled value ({}) lower than the minimum allowed ({})", unscaledValue, unscaledMin);
return false;
} else if (unscaledValue > unscaledMax) {
logger.debug("Unscaled value ({}) bigger than the maximum allowed ({})", unscaledValue, unscaledMax);
LOGGER.debug("Unscaled value ({}) bigger than the maximum allowed ({})", unscaledValue, unscaledMax);
return false;
}

View File

@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
*/
@NonNullByDefault
public class FroniusHttpUtil {
private static final Logger logger = LoggerFactory.getLogger(FroniusHttpUtil.class);
private static final Logger LOGGER = LoggerFactory.getLogger(FroniusHttpUtil.class);
/**
* Issue a HTTP request and retry on failure.
@ -82,17 +82,17 @@ public class FroniusHttpUtil {
if (result != null) {
if (attemptCount > 1) {
logger.debug("Attempt #{} successful {}", attemptCount, url);
LOGGER.debug("Attempt #{} successful {}", attemptCount, url);
}
return result;
}
if (attemptCount >= 3) {
logger.debug("Failed connecting to {} after {} attempts.", url, attemptCount, lastException);
LOGGER.debug("Failed connecting to {} after {} attempts.", url, attemptCount, lastException);
throw new FroniusCommunicationException("Unable to connect", lastException);
}
logger.debug("HTTP error on attempt #{} {}", attemptCount, url);
LOGGER.debug("HTTP error on attempt #{} {}", attemptCount, url);
Thread.sleep(500 * attemptCount);
attemptCount++;
}

View File

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

View File

@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault
public class HeosActions implements ThingActions {
private static final Logger logger = LoggerFactory.getLogger(HeosActions.class);
private final Logger logger = LoggerFactory.getLogger(HeosActions.class);
private @Nullable HeosBridgeHandler handler;

View File

@ -56,7 +56,7 @@ public class CommandTag {
private static final List<Class<? extends Command>> percentCommandType = Arrays.asList(PercentType.class);
private static final Logger logger = LoggerFactory.getLogger(CommandTag.class);
private static final Logger LOGGER = LoggerFactory.getLogger(CommandTag.class);
private String inputLine;
private CommandTagType tagType;
@ -150,15 +150,15 @@ public class CommandTag {
public static @Nullable CommandTag createCommandTag(String inputLine) {
if (inputLine.isEmpty() || !CommandTagType.prefixValid(inputLine)) {
logger.trace("Command Tag Trace: \"{}\" => NOT a (valid) Command Tag!", inputLine);
LOGGER.trace("Command Tag Trace: \"{}\" => NOT a (valid) Command Tag!", inputLine);
return null;
}
try {
final CommandTag tag = new CommandTag(inputLine);
logger.trace("Command Tag Trace: \"{}\" => Fully valid Command Tag!", inputLine);
LOGGER.trace("Command Tag Trace: \"{}\" => Fully valid Command Tag!", inputLine);
return tag;
} catch (IllegalArgumentException e) {
logger.warn("{}", e.getMessage());
LOGGER.warn("{}", e.getMessage());
return null;
}
}

View File

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

View File

@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault
public class LivePanelState implements PanelState {
private static final Logger logger = LoggerFactory.getLogger(LivePanelState.class);
private final Logger logger = LoggerFactory.getLogger(LivePanelState.class);
private final NanoleafPanelColors panelColors;
public LivePanelState(NanoleafPanelColors panelColors) {

View File

@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault
public class NanoleafLayout {
private static final Logger logger = LoggerFactory.getLogger(NanoleafLayout.class);
private static final Logger LOGGER = LoggerFactory.getLogger(NanoleafLayout.class);
private static final Color COLOR_BACKGROUND = Color.WHITE;
public static byte[] render(PanelLayout panelLayout, PanelState state, LayoutSettings settings) throws IOException {
@ -53,13 +53,13 @@ public class NanoleafLayout {
Layout layout = panelLayout.getLayout();
if (layout == null) {
logger.warn("Returning no image as we don't have any layout to render");
LOGGER.warn("Returning no image as we don't have any layout to render");
return new byte[] {};
}
List<PositionDatum> positionDatums = layout.getPositionData();
if (positionDatums == null) {
logger.warn("Returning no image as we don't have any position datums to render");
LOGGER.warn("Returning no image as we don't have any position datums to render");
return new byte[] {};
}

View File

@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
*/
@NonNullByDefault
class SecurityCapability extends RestCapability<SecurityApi> {
private final static ZonedDateTime ZDT_REFERENCE = ZonedDateTime.ofInstant(Instant.ofEpochMilli(0),
private static final ZonedDateTime ZDT_REFERENCE = ZonedDateTime.ofInstant(Instant.ofEpochMilli(0),
ZoneId.systemDefault());
private final Logger logger = LoggerFactory.getLogger(SecurityCapability.class);

View File

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

View File

@ -45,7 +45,7 @@ public class TestGetBytes {
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "TRACE");
}
private static final Logger logger = LoggerFactory.getLogger(ParadoxUtil.class);
private final Logger logger = LoggerFactory.getLogger(ParadoxUtil.class);
private static final byte[] EXPECTED1 = { (byte) 0xAA, 0x0A, 0x00, 0x03, 0x08, (byte) 0xF0, 0x00, 0x00, 0x01,
(byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, 0x01, 0x02, 0x03,

View File

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

View File

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

View File

@ -54,7 +54,7 @@ import org.slf4j.LoggerFactory;
*/
@NonNullByDefault
public class ShellyBluApi extends Shelly2ApiRpc {
private static final Logger logger = LoggerFactory.getLogger(ShellyBluApi.class);
private final Logger logger = LoggerFactory.getLogger(ShellyBluApi.class);
private boolean connected = false; // true = BLU devices has connected
private ShellySettingsStatus deviceStatus = new ShellySettingsStatus();
private int lastPid = -1;

View File

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

View File

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

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
+ 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()

View File

@ -55,7 +55,7 @@ public enum TACmiMeasureType {
private final int typeval;
private final int offset;
private static final Logger logger = LoggerFactory.getLogger(TACmiMeasureType.class);
private static final Logger LOGGER = LoggerFactory.getLogger(TACmiMeasureType.class);
private TACmiMeasureType(int typeval, int offset) {
this.typeval = typeval;
@ -79,7 +79,7 @@ public enum TACmiMeasureType {
return mtype;
}
}
logger.debug("Received unexpected measure type {}", type);
LOGGER.debug("Received unexpected measure type {}", type);
return TACmiMeasureType.UNSUPPORTED;
}
}

View File

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

View File

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

View File

@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault
public class NotificationAction {
private static final Logger logger = LoggerFactory.getLogger(NotificationAction.class);
private static final Logger LOGGER = LoggerFactory.getLogger(NotificationAction.class);
public static @Nullable CloudService cloudService;
@ -81,7 +81,7 @@ public class NotificationAction {
@Nullable String title, @Nullable String referenceId, @Nullable String onClickAction,
@Nullable String mediaAttachmentUrl, @Nullable String actionButton1, @Nullable String actionButton2,
@Nullable String actionButton3) {
logger.debug("sending notification '{}' to user {}", message, userId);
LOGGER.debug("sending notification '{}' to user {}", message, userId);
if (cloudService != null) {
cloudService.sendNotification(userId, message, icon, tag, title, referenceId, onClickAction,
mediaAttachmentUrl, actionButton1, actionButton2, actionButton3);
@ -111,7 +111,7 @@ public class NotificationAction {
*/
@ActionDoc(text = "Sends a log notification which is shown in notifications log to all account users")
public static void sendLogNotification(String message, @Nullable String icon, @Nullable String tag) {
logger.debug("sending log notification '{}'", message);
LOGGER.debug("sending log notification '{}'", message);
if (cloudService != null) {
cloudService.sendLogNotification(message, icon, tag);
}
@ -164,7 +164,7 @@ public class NotificationAction {
@Nullable String title, @Nullable String referenceId, @Nullable String onClickAction,
@Nullable String mediaAttachmentUrl, @Nullable String actionButton1, @Nullable String actionButton2,
@Nullable String actionButton3) {
logger.debug("sending broadcast notification '{}' to all users", message);
LOGGER.debug("sending broadcast notification '{}' to all users", message);
if (cloudService != null) {
cloudService.sendBroadcastNotification(message, icon, tag, title, referenceId, onClickAction,
mediaAttachmentUrl, actionButton1, actionButton2, actionButton3);

View File

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

View File

@ -57,7 +57,7 @@ import org.slf4j.LoggerFactory;
*/
@NonNullByDefault
public class JpaHistoricItem implements HistoricItem {
private static final Logger logger = LoggerFactory.getLogger(JpaHistoricItem.class);
private static final Logger LOGGER = LoggerFactory.getLogger(JpaHistoricItem.class);
private final String name;
private final State state;
@ -123,7 +123,7 @@ public class JpaHistoricItem implements HistoricItem {
// Ensure we return in the item's unit
state = value.toUnit(unit);
if (state == null) {
logger.warn("Persisted state {} for item {} is incompatible with item's unit {}; ignoring", value,
LOGGER.warn("Persisted state {} for item {} is incompatible with item's unit {}; ignoring", value,
item.getName(), unit);
return null;
}

View File

@ -115,7 +115,7 @@ public class MongoDBTypeConversions {
return STATE_CONVERTERS.getOrDefault(state.getClass(), State::toString).apply(state);
}
private static final Logger logger = LoggerFactory.getLogger(MongoDBTypeConversions.class);
private static final Logger LOGGER = LoggerFactory.getLogger(MongoDBTypeConversions.class);
/**
* A map of converters that convert openHAB states to MongoDB compatible types.
@ -199,7 +199,7 @@ public class MongoDBTypeConversions {
if (value instanceof String) {
return new HSBType(value.toString());
} else {
logger.warn("HSBType ({}) value is not a valid string: {}", doc.getString(MongoDBFields.FIELD_REALNAME),
LOGGER.warn("HSBType ({}) value is not a valid string: {}", doc.getString(MongoDBFields.FIELD_REALNAME),
value);
return new HSBType("0,0,0");
}
@ -249,7 +249,7 @@ public class MongoDBTypeConversions {
Binary data = fieldValue.get(MongoDBFields.FIELD_VALUE_DATA, Binary.class);
return new RawType(data.getData(), type);
} else {
logger.warn("ImageItem ({}) value is not a Document: {}", doc.getString(MongoDBFields.FIELD_REALNAME),
LOGGER.warn("ImageItem ({}) value is not a Document: {}", doc.getString(MongoDBFields.FIELD_REALNAME),
value);
return new RawType(new byte[0], "application/octet-stream");
}