Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[multiple] Reduce SAT warnings #17564

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private record ConfigurationChannel(String id, String typeId, String itemType) {
}
};

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) {
Expand All @@ -72,7 +72,7 @@ private static void addLocalConfigurationChannel(Thing originalThing, ThingBuild
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@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;
Expand Down Expand Up @@ -93,7 +93,7 @@ public static byte[][] createRequest(BRC1HCommand command, MadokaValue... parame

return chunks;
} catch (IOException e) {
logger.info("Error while building request", e);
LOGGER.info("Error while building request", e);
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@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()
Expand Down Expand Up @@ -130,7 +130,7 @@ public static void updateHolder(BluetoothGattParser parser, GattRequest request,
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;
}
Expand All @@ -144,7 +144,7 @@ public static void updateHolder(BluetoothGattParser parser, GattRequest request,
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
Expand All @@ -154,7 +154,7 @@ public static void updateHolder(BluetoothGattParser parser, GattRequest request,
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;
}
Expand All @@ -165,7 +165,7 @@ public static void updateHolder(BluetoothGattParser parser, GattRequest request,
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;
}
Expand All @@ -176,7 +176,7 @@ public static void updateHolder(BluetoothGattParser parser, GattRequest request,
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;
}
Expand All @@ -186,7 +186,7 @@ public static void updateHolder(BluetoothGattParser parser, GattRequest request,
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -71,13 +71,13 @@ public boolean supportsWarningBroadcast() {
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ private boolean changeHomekitMode(String homekitmode) throws DaikinCommunication
return false;
}

boolean changeModeSuccess = false;
updateState(DaikinBindingConstants.CHANNEL_AC_POWER, OnOffType.from(power));

String newMode = switch (mode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ private void scheduleConnectRetry(long waitMinutes) {
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@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 {
Expand All @@ -70,7 +70,7 @@ public static EEP buildEEP(EEPType eepType, ERP1Message packet) {
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());
Expand All @@ -80,16 +80,16 @@ public static EEP buildEEP(EEPType eepType, ERP1Message packet) {
}

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;
}
}
Expand Down Expand Up @@ -155,7 +155,7 @@ public static EEP buildEEP(EEPType eepType, ERP1Message packet) {
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);
}

Expand All @@ -167,7 +167,7 @@ public static EEP buildEEP(EEPType eepType, ERP1Message packet) {
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 }));
Expand Down Expand Up @@ -229,7 +229,7 @@ public static EEP buildEEP(EEPType eepType, ERP1Message packet) {

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 }));

Expand Down Expand Up @@ -263,22 +263,22 @@ public static SMACKTeachInResponse buildResponseFromSMACKTeachIn(EventMessage ev

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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
@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);
Expand Down Expand Up @@ -71,10 +71,10 @@ public static State validateTotalUsage(State value, @Nullable State currentState

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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
@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.
Expand Down Expand Up @@ -82,17 +82,17 @@ public static synchronized String executeUrl(HttpMethod httpMethod, String url,

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++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @author Christian Feininger - Initial contribution
*/
public class HaasSohnpelletstoveJsonDataDTO {
metadata meta = new metadata();
Metadata meta = new Metadata();
boolean prg;
boolean wprg;
String mode = "";
Expand All @@ -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;
Expand Down Expand Up @@ -98,7 +98,7 @@ public HaasSohnpelletstoveJsonDataDTO getResponse() {
return this;
}

public class metadata {
public class Metadata {
@SerializedName("sw_version")
String swVersion = "";
@SerializedName("hw_version")
Expand All @@ -119,19 +119,19 @@ public class metadata {
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 = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -150,15 +150,15 @@ else if (targetState.endsWith("%")) {

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;
}
}
Expand Down
Loading