Skip to content

Commit

Permalink
fixed some warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Friese <af944580@googlemail.com>
  • Loading branch information
alexf2015 committed Sep 21, 2024
1 parent 5c6c363 commit d43a139
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ public void onContent(@Nullable Response response, @Nullable ByteBuffer content)
if (response != null && content != null) {
super.onContent(response, content);
}
logger.debug("[{}] received content, length: {}, encoding: {}", getClass().getSimpleName(),
getContentAsString().length(), this.getEncoding());
var contentAsString = getContentAsString();
var contentLength = contentAsString == null ? 0 : contentAsString.length();
logger.debug("[{}] received content, length: {}, encoding: {}", getClass().getSimpleName(), contentLength,
this.getEncoding());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
import org.openhab.core.library.types.StringType;
import org.openhab.core.thing.Channel;
import org.openhab.core.types.Command;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
Expand All @@ -44,7 +42,6 @@
*/
@NonNullByDefault
public class SetPointsAdvanced extends AbstractWriteCommand {
private final Logger logger = LoggerFactory.getLogger(SetPointsAdvanced.class);
private final String url;

public SetPointsAdvanced(MyUplinkThingHandler handler, Channel channel, Command command, String deviceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public Channel createChannel(ThingUID thingUID, JsonObject channelData) {
String determineAcceptedType(ChannelTypeUID channelTypeUID, String unit) {
if (channelTypeUID.getId().equals(CHANNEL_TYPE_RW_SWITCH)) {
return CoreItemFactory.SWITCH;
} else if (unit == null || unit.isEmpty()) {
} else if (unit.isEmpty()) {
return CoreItemFactory.NUMBER;
} else {
Unit<?> parsedUnit = UnitUtils.parseUnit(unit);
Expand Down Expand Up @@ -215,7 +215,7 @@ private ChannelTypeUID determineStaticEnumType(JsonArray enumValues, boolean wri
boolean containsOnAt1 = false;

for (var element : enumValues) {
var enumText = Utils.getAsString(element.getAsJsonObject(), JSON_ENUM_KEY_TEXT).toLowerCase();
var enumText = Utils.getAsString(element.getAsJsonObject(), JSON_ENUM_KEY_TEXT, "").toLowerCase();
var enumOrdinal = Utils.getAsString(element.getAsJsonObject(), JSON_KEY_CHANNEL_VALUE, GENERIC_NO_VAL);

switch (enumText) {
Expand Down

0 comments on commit d43a139

Please sign in to comment.