diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoBrainApi.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoBrainApi.java index 26ffb6ac9bd..9350a5e82a0 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoBrainApi.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoBrainApi.java @@ -13,7 +13,10 @@ package org.openhab.binding.neeo.internal; import java.io.IOException; +import java.lang.reflect.Type; import java.net.URL; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; @@ -31,6 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; /** * The class provides the API for communicating with a NEEO brain @@ -162,7 +166,7 @@ public class NeeoBrainApi implements AutoCloseable { * @return the non-null, possibly empty list of active scenarios keys * @throws IOException Signals that an I/O exception has occurred. */ - public String[] getActiveScenarios() throws IOException { + public List getActiveScenarios() throws IOException { final String url = urlBuilder.append(NeeoConstants.GET_ACTIVESCENARIOS).toString(); final HttpRequest rqst = request.get(); @@ -171,7 +175,9 @@ public class NeeoBrainApi implements AutoCloseable { throw resp.createException(); } - return Objects.requireNonNull(gson.fromJson(resp.getContent(), String[].class)); + Type arrayListType = new TypeToken>() { + }.getType(); + return Objects.requireNonNull(gson.fromJson(resp.getContent(), arrayListType)); } /** diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoBrainConfig.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoBrainConfig.java index 555ee0c0e7f..089ac6661f4 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoBrainConfig.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoBrainConfig.java @@ -132,4 +132,11 @@ public class NeeoBrainConfig { public void setCheckStatusInterval(int checkStatusInterval) { this.checkStatusInterval = checkStatusInterval; } + + @Override + public String toString() { + return "NeeoBrainConfig{" + "ipAddress='" + ipAddress + '\'' + ", enableForwardActions=" + enableForwardActions + + ", forwardChain='" + forwardChain + '\'' + ", discoverEmptyRooms=" + discoverEmptyRooms + + ", checkStatusInterval=" + checkStatusInterval + '}'; + } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoRoomProtocol.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoRoomProtocol.java index e4abd30f59a..f8d014744a5 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoRoomProtocol.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoRoomProtocol.java @@ -13,11 +13,11 @@ package org.openhab.binding.neeo.internal; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.neeo.internal.models.ExecuteResult; @@ -53,7 +53,7 @@ public class NeeoRoomProtocol { private final NeeoRoom neeoRoom; /** The currently active scenarios */ - private final AtomicReference activeScenarios = new AtomicReference<>(new String[0]); + private final AtomicReference> activeScenarios = new AtomicReference<>(new ArrayList<>()); /** * Instantiates a new neeo room protocol. @@ -95,8 +95,8 @@ public class NeeoRoomProtocol { Objects.requireNonNull(action, "action cannot be null"); final NeeoRecipes recipes = neeoRoom.getRecipes(); - final boolean launch = StringUtils.equalsIgnoreCase(NeeoRecipe.LAUNCH, action.getAction()); - final boolean poweroff = StringUtils.equalsIgnoreCase(NeeoRecipe.POWEROFF, action.getAction()); + final boolean launch = NeeoRecipe.LAUNCH.equalsIgnoreCase(action.getAction()); + final boolean poweroff = NeeoRecipe.POWEROFF.equalsIgnoreCase(action.getAction()); // Can't be both true but if both false - it's neither one if (launch == poweroff) { @@ -107,7 +107,7 @@ public class NeeoRoomProtocol { final NeeoRecipe recipe = recipeName == null ? null : recipes.getRecipeByName(recipeName); final String scenarioKey = recipe == null ? null : recipe.getScenarioKey(); - if (scenarioKey != null && StringUtils.isNotEmpty(scenarioKey)) { + if (scenarioKey != null && !scenarioKey.isEmpty()) { processScenarioChange(scenarioKey, launch); } else { logger.debug("Could not find a recipe named '{}' for the action {}", recipeName, action); @@ -123,18 +123,27 @@ public class NeeoRoomProtocol { private void processScenarioChange(String scenarioKey, boolean launch) { NeeoUtil.requireNotEmpty(scenarioKey, "scenarioKey cannot be empty"); - final String[] activeScenarios = this.activeScenarios.get(); - final int idx = ArrayUtils.indexOf(activeScenarios, scenarioKey); + List oldActiveScenarios; + List newActiveScenarios; - // already set that way - if ((idx < 0 && !launch) || (idx >= 0 && launch)) { - return; - } + do { + oldActiveScenarios = this.activeScenarios.get(); + newActiveScenarios = new ArrayList<>(oldActiveScenarios); - final String[] newScenarios = idx >= 0 ? (String[]) ArrayUtils.remove(activeScenarios, idx) - : (String[]) ArrayUtils.add(activeScenarios, scenarioKey); - - this.activeScenarios.set(newScenarios); + if (newActiveScenarios.contains(scenarioKey)) { + if (launch) { + return; + } else { + newActiveScenarios.remove(scenarioKey); + } + } else { + if (launch) { + newActiveScenarios.add(scenarioKey); + } else { + return; + } + } + } while (!this.activeScenarios.compareAndSet(oldActiveScenarios, newActiveScenarios)); refreshScenarioStatus(scenarioKey); } @@ -247,10 +256,9 @@ public class NeeoRoomProtocol { final NeeoScenario scenario = neeoRoom.getScenarios().getScenario(scenarioKey); if (scenario != null) { - final String[] active = activeScenarios.get(); - final boolean isActive = ArrayUtils.contains(active, scenarioKey); + final boolean isActive = activeScenarios.get().contains(scenarioKey); callback.stateChanged(UidUtils.createChannelId(NeeoConstants.ROOM_GROUP_SCENARIO_ID, - NeeoConstants.ROOM_CHANNEL_STATUS, scenarioKey), isActive ? OnOffType.ON : OnOffType.OFF); + NeeoConstants.ROOM_CHANNEL_STATUS, scenarioKey), OnOffType.from(isActive)); } } @@ -263,19 +271,13 @@ public class NeeoRoomProtocol { logger.debug("API is null [likely bridge is offline]"); } else { try { - final String[] activeScenarios = api.getActiveScenarios(); - final String[] oldScenarios = this.activeScenarios.getAndSet(activeScenarios); + final List activeScenarios = api.getActiveScenarios(); + final List oldScenarios = this.activeScenarios.getAndSet(activeScenarios); - if (!ArrayUtils.isEquals(activeScenarios, oldScenarios)) { - for (String scenario : activeScenarios) { - refreshScenarioStatus(scenario); - } - - for (String oldScenario : oldScenarios) { - if (!ArrayUtils.contains(activeScenarios, oldScenario)) { - refreshScenarioStatus(oldScenario); - } - } + if (!activeScenarios.equals(oldScenarios)) { + activeScenarios.forEach(this::refreshScenarioStatus); + oldScenarios.removeIf(activeScenarios::contains); + oldScenarios.forEach(this::refreshScenarioStatus); } } catch (IOException e) { logger.debug("Exception requesting active scenarios: {}", e.getMessage(), e); @@ -292,7 +294,7 @@ public class NeeoRoomProtocol { private void sendCurrentStepTrigger(@Nullable String step) { callback.triggerEvent( UidUtils.createChannelId(NeeoConstants.ROOM_GROUP_STATE_ID, NeeoConstants.ROOM_CHANNEL_CURRENTSTEP), - step == null || StringUtils.isEmpty(step) ? "" : step); + step == null || step.isEmpty() ? "" : step); } /** @@ -312,10 +314,10 @@ public class NeeoRoomProtocol { if (recipe != null) { if (recipe.isEnabled()) { - final boolean isLaunch = StringUtils.equalsIgnoreCase(NeeoRecipe.LAUNCH, recipe.getType()); + final boolean isLaunch = NeeoRecipe.LAUNCH.equalsIgnoreCase(recipe.getType()); try { - if (isLaunch || scenarioKey == null || StringUtils.isEmpty(scenarioKey)) { + if (isLaunch || scenarioKey == null || scenarioKey.isEmpty()) { handleExecuteResult(scenarioKey, recipeKey, true, api.executeRecipe(roomKey, recipeKey)); } else { handleExecuteResult(scenarioKey, recipeKey, false, api.stopScenario(roomKey, scenarioKey)); @@ -345,7 +347,7 @@ public class NeeoRoomProtocol { start ? NeeoRecipe.LAUNCH : NeeoRecipe.POWEROFF); final String recipeKey = recipe == null ? null : recipe.getKey(); - if (recipe != null && recipeKey != null && StringUtils.isNotEmpty(recipeKey)) { + if (recipe != null && recipeKey != null && !recipeKey.isEmpty()) { if (recipe.isEnabled()) { startRecipe(recipeKey); } else { @@ -370,7 +372,7 @@ public class NeeoRoomProtocol { NeeoUtil.requireNotEmpty(recipeKey, "recipeKey cannot be empty"); int nextStep = 0; - if (scenarioKey != null && StringUtils.isNotEmpty(scenarioKey)) { + if (scenarioKey != null && !scenarioKey.isEmpty()) { callback.scheduleTask(() -> { processScenarioChange(scenarioKey, launch); }, 1); diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoUtil.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoUtil.java index c393276da07..ee3a8e610b2 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoUtil.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/NeeoUtil.java @@ -12,10 +12,8 @@ */ package org.openhab.binding.neeo.internal; -import java.util.Objects; import java.util.concurrent.Future; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.neeo.internal.models.NeeoDevices; @@ -104,8 +102,7 @@ public class NeeoUtil { * @throws IllegalArgumentException if value is an empty string */ public static void requireNotEmpty(@Nullable String value, String msg) { - Objects.requireNonNull(value, msg); - if (StringUtils.isEmpty(value)) { + if (value == null || value.isEmpty()) { throw new IllegalArgumentException(msg); } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/UidUtils.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/UidUtils.java index 5a23a567c14..fed0a432466 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/UidUtils.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/UidUtils.java @@ -12,9 +12,6 @@ */ package org.openhab.binding.neeo.internal; -import java.util.Objects; - -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.neeo.internal.models.NeeoDevice; @@ -66,8 +63,6 @@ public class UidUtils { * @return the non-null, non empty (only 1 or 2 element) list of parts */ public static String[] parseChannelId(ChannelUID uid) { - Objects.requireNonNull(uid, "uid cannot be null"); - final String channelId = uid.getIdWithoutGroup(); final int idx = channelId.indexOf(DELIMITER); if (idx < 0 || idx == channelId.length() - 1) { @@ -101,8 +96,8 @@ public class UidUtils { public static String createChannelId(@Nullable String groupId, String channelId, @Nullable String channelKey) { NeeoUtil.requireNotEmpty(channelId, "channelId cannot be empty"); - return (StringUtils.isEmpty(groupId) ? "" : (groupId + "#")) - + (StringUtils.isEmpty(channelKey) ? channelId : (channelId + DELIMITER + channelKey)); + return ((groupId == null || groupId.isEmpty()) ? "" : (groupId + "#")) + + ((channelKey == null || channelKey.isEmpty()) ? channelId : (channelId + DELIMITER + channelKey)); } /** @@ -129,6 +124,6 @@ public class UidUtils { public static ChannelUID createChannelUID(ThingUID thingUid, String groupId, String channelId, @Nullable String channelKey) { return new ChannelUID(thingUid, groupId, - channelId + (StringUtils.isEmpty(channelKey) ? "" : (DELIMITER + channelKey))); + channelId + ((channelKey == null || channelKey.isEmpty()) ? "" : (DELIMITER + channelKey))); } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoBrainDiscovery.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoBrainDiscovery.java index bfdb2b834f7..e77d14a63d1 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoBrainDiscovery.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoBrainDiscovery.java @@ -24,7 +24,6 @@ import java.util.Set; import javax.jmdns.ServiceInfo; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.neeo.internal.NeeoConstants; @@ -100,7 +99,7 @@ public class NeeoBrainDiscovery implements MDNSDiscoveryParticipant { } logger.debug("getThingUID is evaluating: {}", service); - if (!StringUtils.equals("neeo", service.getApplication())) { + if (!"neeo".equals(service.getApplication())) { logger.debug("Application not 'neeo' in MDNS serviceinfo: {}", service); return null; } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoDeviceDiscoveryService.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoDeviceDiscoveryService.java index 91aeb9f4416..820cc44311c 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoDeviceDiscoveryService.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoDeviceDiscoveryService.java @@ -17,7 +17,6 @@ import java.util.Collections; import java.util.Objects; import java.util.Set; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.binding.neeo.internal.NeeoBrainApi; import org.openhab.binding.neeo.internal.NeeoConstants; @@ -73,7 +72,7 @@ public class NeeoDeviceDiscoveryService extends AbstractDiscoveryService { final ThingUID roomUid = roomBridge.getUID(); final String brainId = roomHandler.getNeeoBrainId(); - if (brainId == null || StringUtils.isEmpty(brainId)) { + if (brainId == null || brainId.isEmpty()) { logger.debug("Unknown brain ID for roomHandler: {}", roomHandler); return; } @@ -86,7 +85,7 @@ public class NeeoDeviceDiscoveryService extends AbstractDiscoveryService { final NeeoRoomConfig config = roomBridge.getConfiguration().as(NeeoRoomConfig.class); final String roomKey = config.getRoomKey(); - if (roomKey == null || StringUtils.isEmpty(roomKey)) { + if (roomKey == null || roomKey.isEmpty()) { logger.debug("RoomKey wasn't configured for {} - skipping", brainId); return; } @@ -103,7 +102,7 @@ public class NeeoDeviceDiscoveryService extends AbstractDiscoveryService { logger.debug("Room {} found, scanning {} devices in it", room.getName(), devices.length); for (NeeoDevice device : devices) { final String deviceKey = device.getKey(); - if (deviceKey == null || StringUtils.isEmpty(deviceKey)) { + if (deviceKey == null || deviceKey.isEmpty()) { logger.debug("Device key wasn't found for device: {}", device); continue; } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoRoomDiscoveryService.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoRoomDiscoveryService.java index c863e63ef64..773b9e04d82 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoRoomDiscoveryService.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/discovery/NeeoRoomDiscoveryService.java @@ -17,7 +17,6 @@ import java.util.Collections; import java.util.Objects; import java.util.Set; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.binding.neeo.internal.NeeoBrainApi; import org.openhab.binding.neeo.internal.NeeoBrainConfig; @@ -91,7 +90,7 @@ public class NeeoRoomDiscoveryService extends AbstractDiscoveryService { logger.debug("Brain {} ({}) found, scanning {} rooms in it", brain.getName(), brainId, rooms.length); for (NeeoRoom room : rooms) { final String roomKey = room.getKey(); - if (roomKey == null || StringUtils.isEmpty(roomKey)) { + if (roomKey == null || roomKey.isEmpty()) { logger.debug("Room didn't have a room key: {}", room); continue; } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/ChannelUtils.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/ChannelUtils.java index 76f70c13c9e..e9ab97d1266 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/ChannelUtils.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/ChannelUtils.java @@ -14,9 +14,7 @@ package org.openhab.binding.neeo.internal.handler; import java.util.ArrayList; import java.util.List; -import java.util.Objects; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.binding.neeo.internal.NeeoConstants; import org.openhab.binding.neeo.internal.UidUtils; @@ -47,18 +45,16 @@ class ChannelUtils { * @return a non-null but possibly empty list of {@link Channel} s */ static List generateChannels(ThingUID thingUid, NeeoDevice device) { - Objects.requireNonNull(thingUid, "thingUid cannot be null"); - Objects.requireNonNull(device, "device cannot be null"); - final List channels = new ArrayList<>(); for (NeeoMacro macro : device.getMacros().getMacros()) { final String key = macro.getKey(); - if (key != null && StringUtils.isNotEmpty(key)) { - final String label = StringUtils.isEmpty(macro.getName()) ? macro.getLabel() : macro.getName(); + if (key != null && !key.isEmpty()) { + String name = macro.getName(); + final String label = (name == null || name.isEmpty()) ? macro.getLabel() : name; channels.add(ChannelBuilder .create(UidUtils.createChannelUID(thingUid, NeeoConstants.DEVICE_GROUP_MACROS_ID, NeeoConstants.DEVICE_CHANNEL_STATUS, key), "Switch") - .withLabel(label == null || StringUtils.isEmpty(label) ? key : label) + .withLabel((label == null || label.isEmpty()) ? key : label) .withType(NeeoConstants.DEVICE_MACRO_STATUS_UID).build()); } } @@ -74,9 +70,6 @@ class ChannelUtils { * @return a non-null but possibly empty list of {@link Channel} s */ static List generateChannels(ThingUID thingUid, NeeoRoom room) { - Objects.requireNonNull(thingUid, "thingUid cannot be null"); - Objects.requireNonNull(room, "room cannot be null"); - final List channels = new ArrayList<>(); channels.addAll(generateStateChannels(thingUid)); channels.addAll(generateScenarioChannels(thingUid, room.getScenarios())); @@ -91,8 +84,6 @@ class ChannelUtils { * @return a non-null but possibly empty list of {@link Channel} s */ private static List generateStateChannels(ThingUID thingUid) { - Objects.requireNonNull(thingUid, "thingUid cannot be null"); - final List channels = new ArrayList<>(); channels.add(ChannelBuilder .create(UidUtils.createChannelUID(thingUid, NeeoConstants.ROOM_GROUP_STATE_ID, @@ -109,20 +100,15 @@ class ChannelUtils { * @return a non-null but possibly empty list of {@link Channel} s */ private static List generateScenarioChannels(ThingUID thingUid, NeeoScenarios scenarios) { - Objects.requireNonNull(thingUid, "thingUid cannot be null"); - Objects.requireNonNull(scenarios, "scenarios cannot be null"); - final List channels = new ArrayList<>(); for (NeeoScenario scenario : scenarios.getScenarios()) { final String key = scenario.getKey(); - if (key != null && StringUtils.isNotEmpty(key)) { - final String scenarioLabel = StringUtils.isEmpty(scenario.getName()) ? null : scenario.getName(); - final String nameLabel = (scenarioLabel == null || StringUtils.isEmpty(scenarioLabel) ? key - : scenarioLabel) + " Name"; - final String configuredLabel = (scenarioLabel == null || StringUtils.isEmpty(scenarioLabel) ? key - : scenarioLabel) + " Configured"; - final String statusLabel = (scenarioLabel == null || StringUtils.isEmpty(scenarioLabel) ? key - : scenarioLabel) + " Status"; + if (key != null && !key.isEmpty()) { + final String name = scenario.getName(); + final String scenarioLabel = (name == null || name.isEmpty()) ? key : name; + final String nameLabel = scenarioLabel + " Name"; + final String configuredLabel = scenarioLabel + " Configured"; + final String statusLabel = scenarioLabel + " Status"; channels.add(ChannelBuilder .create(UidUtils.createChannelUID(thingUid, NeeoConstants.ROOM_GROUP_SCENARIO_ID, @@ -149,22 +135,16 @@ class ChannelUtils { * @return a non-null but possibly empty list of {@link Channel} s */ private static List generateRecipeChannels(ThingUID thingUid, NeeoRecipes recipes) { - Objects.requireNonNull(thingUid, "thingUid cannot be null"); - Objects.requireNonNull(recipes, "recipes cannot be null"); - final List channels = new ArrayList<>(); for (NeeoRecipe recipe : recipes.getRecipes()) { final String key = recipe.getKey(); - if (key != null && StringUtils.isNotEmpty(key)) { - final String recipeLabel = StringUtils.isEmpty(recipe.getName()) ? null : recipe.getName(); - final String nameLabel = (recipeLabel == null || StringUtils.isEmpty(recipeLabel) ? key : recipeLabel) - + " Name (" + recipe.getType() + ")"; - final String typeLabel = (recipeLabel == null || StringUtils.isEmpty(recipeLabel) ? key : recipeLabel) - + " Type (" + recipe.getType() + ")"; - final String enabledLabel = (recipeLabel == null || StringUtils.isEmpty(recipeLabel) ? key - : recipeLabel) + " Enabled (" + recipe.getType() + ")"; - final String statusLabel = (recipeLabel == null || StringUtils.isEmpty(recipeLabel) ? key : recipeLabel) - + " Status (" + recipe.getType() + ")"; + if (key != null && !key.isEmpty()) { + final String name = recipe.getName(); + final String recipeLabel = (name == null || name.isEmpty()) ? key : name; + final String nameLabel = recipeLabel + " Name (" + recipe.getType() + ")"; + final String typeLabel = recipeLabel + " Type (" + recipe.getType() + ")"; + final String enabledLabel = recipeLabel + " Enabled (" + recipe.getType() + ")"; + final String statusLabel = recipeLabel + " Status (" + recipe.getType() + ")"; channels.add(ChannelBuilder .create(UidUtils.createChannelUID(thingUid, NeeoConstants.ROOM_GROUP_RECIPE_ID, diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoBrainHandler.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoBrainHandler.java index 3c797a4ffb6..a71482bb74d 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoBrainHandler.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoBrainHandler.java @@ -31,7 +31,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import javax.servlet.ServletException; import javax.ws.rs.client.ClientBuilder; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.neeo.internal.NeeoBrainApi; @@ -130,7 +129,7 @@ public class NeeoBrainHandler extends BaseBridgeHandler { } /** - * Handles any {@Commands} sent - this bridge has no commands and does nothing + * Handles any {@link Command} sent - this bridge has no commands and does nothing * * @see * org.openhab.core.thing.binding.ThingHandler#handleCommand(org.openhab.core.thing.ChannelUID, @@ -163,8 +162,10 @@ public class NeeoBrainHandler extends BaseBridgeHandler { NeeoUtil.checkInterrupt(); final NeeoBrainConfig config = getBrainConfig(); + logger.trace("Brain-UID {}: config is {}", thing.getUID(), config); + final String ipAddress = config.getIpAddress(); - if (ipAddress == null || StringUtils.isEmpty(ipAddress)) { + if (ipAddress == null || ipAddress.isEmpty()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Brain IP Address must be specified"); return; @@ -186,7 +187,8 @@ public class NeeoBrainHandler extends BaseBridgeHandler { addProperty(properties, "Last Change", String.valueOf(brain.getLastChange())); updateProperties(properties); - if (config.isEnableForwardActions()) { + String forwardChain = config.getForwardChain(); + if (config.isEnableForwardActions() && forwardChain != null && !forwardChain.isEmpty()) { NeeoUtil.checkInterrupt(); forwardActionServlet = new NeeoForwardActionsServlet(scheduler, json -> { @@ -200,7 +202,7 @@ public class NeeoBrainHandler extends BaseBridgeHandler { ((NeeoRoomHandler) th).processAction(action); } } - }, config.getForwardChain(), clientBuilder); + }, forwardChain, clientBuilder); NeeoUtil.checkInterrupt(); try { @@ -240,7 +242,7 @@ public class NeeoBrainHandler extends BaseBridgeHandler { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Exception occurred connecting to brain: " + e.getMessage()); } catch (InterruptedException e) { - logger.debug("Initializtion was interrupted", e); + logger.debug("Initialization was interrupted", e); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.HANDLER_INITIALIZING_ERROR, "Initialization was interrupted"); } finally { @@ -256,9 +258,7 @@ public class NeeoBrainHandler extends BaseBridgeHandler { * @param value a possibly null, possibly empty key */ private void addProperty(Map properties, String key, @Nullable String value) { - Objects.requireNonNull(properties, "properties cannot be null"); - NeeoUtil.requireNotEmpty(key, "key cannot be empty"); - if (value != null && StringUtils.isNotEmpty(value)) { + if (value != null && !value.isEmpty()) { properties.put(key, value); } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoDeviceHandler.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoDeviceHandler.java index 634c290e485..17bef68723e 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoDeviceHandler.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoDeviceHandler.java @@ -13,6 +13,7 @@ package org.openhab.binding.neeo.internal.handler; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -20,8 +21,8 @@ import java.util.concurrent.Future; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.neeo.internal.NeeoBrainApi; @@ -104,11 +105,11 @@ public class NeeoDeviceHandler extends BaseThingHandler { } final String localGroupId = channelUID.getGroupId(); - final String groupId = localGroupId == null || StringUtils.isEmpty(localGroupId) ? "" : localGroupId; + final String groupId = localGroupId == null || localGroupId.isEmpty() ? "" : localGroupId; final String channelId = channelIds[0]; final String channelKey = channelIds.length > 1 ? channelIds[1] : ""; - if (StringUtils.isEmpty(groupId)) { + if (groupId.isEmpty()) { logger.debug("GroupID for channel is null - ignoring command: {}", channelUID); return; } @@ -176,14 +177,14 @@ public class NeeoDeviceHandler extends BaseThingHandler { final NeeoDeviceConfig config = getConfigAs(NeeoDeviceConfig.class); final String roomKey = getRoomKey(); - if (roomKey == null || StringUtils.isEmpty(roomKey)) { + if (roomKey == null || roomKey.isEmpty()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Room key (from the parent room bridge) was not found"); return; } final String deviceKey = config.getDeviceKey(); - if (deviceKey == null || StringUtils.isEmpty(deviceKey)) { + if (deviceKey == null || deviceKey.isEmpty()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Device key was not found or empty"); return; @@ -225,7 +226,8 @@ public class NeeoDeviceHandler extends BaseThingHandler { properties.put("Shutdown Delay", toString(timing.getShutdownDelay())); } - properties.put("Device Capabilities", StringUtils.join(details.getDeviceCapabilities(), ',')); + properties.put("Device Capabilities", + Arrays.stream(details.getDeviceCapabilities()).collect(Collectors.joining(","))); } final ThingBuilder thingBuilder = editThing(); @@ -292,7 +294,7 @@ public class NeeoDeviceHandler extends BaseThingHandler { private void addProperty(Map properties, String key, @Nullable String value) { Objects.requireNonNull(properties, "properties cannot be null"); NeeoUtil.requireNotEmpty(key, "key cannot be empty"); - if (value != null && StringUtils.isNotEmpty(value)) { + if (value != null && !value.isEmpty()) { properties.put(key, value); } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoForwardActionsServlet.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoForwardActionsServlet.java index 5c2565b5ec1..299d820263c 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoForwardActionsServlet.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoForwardActionsServlet.java @@ -13,15 +13,14 @@ package org.openhab.binding.neeo.internal.handler; import java.io.IOException; -import java.util.Objects; import java.util.concurrent.ScheduledExecutorService; +import java.util.stream.Collectors; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.client.ClientBuilder; -import org.apache.commons.io.IOUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jetty.http.HttpStatus; @@ -48,7 +47,6 @@ public class NeeoForwardActionsServlet extends HttpServlet { private final Callback callback; /** The forwarding chain */ - @Nullable private final String forwardChain; /** The {@link ClientBuilder} to use */ @@ -64,13 +62,10 @@ public class NeeoForwardActionsServlet extends HttpServlet { * @param callback a non-null {@link Callback} * @param forwardChain a possibly null, possibly empty forwarding chain */ - NeeoForwardActionsServlet(ScheduledExecutorService scheduler, Callback callback, @Nullable String forwardChain, + NeeoForwardActionsServlet(ScheduledExecutorService scheduler, Callback callback, String forwardChain, ClientBuilder clientBuilder) { super(); - Objects.requireNonNull(scheduler, "scheduler cannot be null"); - Objects.requireNonNull(callback, "callback cannot be null"); - this.scheduler = scheduler; this.callback = callback; this.forwardChain = forwardChain; @@ -78,7 +73,7 @@ public class NeeoForwardActionsServlet extends HttpServlet { } /** - * Processes the post action from the NEEO brain. Simply get's the specified json and then forwards it on (if + * Processes the post action from the NEEO brain. Simply gets the specified json and then forwards it on (if * needed) * * @param req the non-null request @@ -91,27 +86,24 @@ public class NeeoForwardActionsServlet extends HttpServlet { return; } - final String json = IOUtils.toString(req.getReader()); + final String json = req.getReader().lines().collect(Collectors.joining("\n")); logger.debug("handleForwardActions {}", json); callback.post(json); - final String fc = forwardChain; - if (fc != null && !fc.isEmpty()) { - scheduler.execute(() -> { - try (final HttpRequest request = new HttpRequest(clientBuilder)) { - for (final String forwardUrl : fc.split(",")) { - if (forwardUrl != null && !forwardUrl.isEmpty()) { - final HttpResponse httpResponse = request.sendPostJsonCommand(forwardUrl, json); - if (httpResponse.getHttpCode() != HttpStatus.OK_200) { - logger.debug("Cannot forward event {} to {}: {}", json, forwardUrl, - httpResponse.getHttpCode()); - } + scheduler.execute(() -> { + try (final HttpRequest request = new HttpRequest(clientBuilder)) { + for (final String forwardUrl : forwardChain.split(",")) { + if (forwardUrl != null && !forwardUrl.isEmpty()) { + final HttpResponse httpResponse = request.sendPostJsonCommand(forwardUrl, json); + if (httpResponse.getHttpCode() != HttpStatus.OK_200) { + logger.debug("Cannot forward event {} to {}: {}", json, forwardUrl, + httpResponse.getHttpCode()); } } } - }); - } + } + }); } interface Callback { diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoRoomHandler.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoRoomHandler.java index 0b2b1a43c7c..71e134696d3 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoRoomHandler.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/handler/NeeoRoomHandler.java @@ -20,7 +20,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.neeo.internal.NeeoBrainApi; @@ -99,7 +98,7 @@ public class NeeoRoomHandler extends BaseBridgeHandler { } final String localGroupId = channelUID.getGroupId(); - final String groupId = localGroupId == null || StringUtils.isEmpty(localGroupId) ? "" : localGroupId; + final String groupId = localGroupId == null || localGroupId.isEmpty() ? "" : localGroupId; final String channelId = channelIds[0]; final String channelKey = channelIds.length > 1 ? channelIds[1] : ""; @@ -195,7 +194,7 @@ public class NeeoRoomHandler extends BaseBridgeHandler { final NeeoRoomConfig config = getConfigAs(NeeoRoomConfig.class); final String roomKey = config.getRoomKey(); - if (roomKey == null || StringUtils.isEmpty(roomKey)) { + if (roomKey == null || roomKey.isEmpty()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Room key (from the parent room bridge) was not found"); return; diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoDeviceDetails.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoDeviceDetails.java index 78f40143a13..4a481898299 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoDeviceDetails.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoDeviceDetails.java @@ -12,7 +12,8 @@ */ package org.openhab.binding.neeo.internal.models; -import org.apache.commons.lang.StringUtils; +import java.util.Arrays; + import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -123,8 +124,8 @@ public class NeeoDeviceDetails { @Override public String toString() { - return "NeeoDeviceDetails [sourceName=" + sourceName + ", adapterName=" + adapterName + ", type=" + type - + ", manufacturer=" + manufacturer + ", name=" + name + ", timing=" + timing + ", deviceCapabilities=" - + StringUtils.join(deviceCapabilities, ',') + "]"; + return "NeeoDeviceDetails{" + "sourceName='" + sourceName + '\'' + ", adapterName='" + adapterName + '\'' + + ", type='" + type + '\'' + ", manufacturer='" + manufacturer + '\'' + ", name='" + name + '\'' + + ", timing=" + timing + ", deviceCapabilities=" + Arrays.toString(deviceCapabilities) + '}'; } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoDevices.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoDevices.java index 31c7e62d943..f86a99600c0 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoDevices.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoDevices.java @@ -15,7 +15,6 @@ package org.openhab.binding.neeo.internal.models; import java.util.Arrays; import java.util.Objects; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -59,7 +58,7 @@ public class NeeoDevices { @Nullable public NeeoDevice getDevice(String key) { for (NeeoDevice device : getDevices()) { - if (StringUtils.equalsIgnoreCase(key, device.getKey())) { + if (key.equalsIgnoreCase(device.getKey())) { return device; } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoMacros.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoMacros.java index 9c73342332d..2d371590e0b 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoMacros.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoMacros.java @@ -15,7 +15,6 @@ package org.openhab.binding.neeo.internal.models; import java.util.Arrays; import java.util.Objects; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -59,7 +58,7 @@ public class NeeoMacros { @Nullable public NeeoMacro getMacro(String key) { for (NeeoMacro macro : getMacros()) { - if (StringUtils.equalsIgnoreCase(key, macro.getKey())) { + if (key.equalsIgnoreCase(macro.getKey())) { return macro; } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoRecipes.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoRecipes.java index bbaa183dbae..68451210d9a 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoRecipes.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoRecipes.java @@ -13,9 +13,7 @@ package org.openhab.binding.neeo.internal.models; import java.util.Arrays; -import java.util.Objects; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -28,7 +26,7 @@ import org.eclipse.jdt.annotation.Nullable; public class NeeoRecipes { /** The recipes. */ - private NeeoRecipe @Nullable [] recipes; + private NeeoRecipe[] recipes; /** * Creates the recipes from the given recipes @@ -36,7 +34,6 @@ public class NeeoRecipes { * @param recipes the recipes */ NeeoRecipes(NeeoRecipe[] recipes) { - Objects.requireNonNull(recipes, "recipes cannot be null"); this.recipes = recipes; } @@ -46,8 +43,7 @@ public class NeeoRecipes { * @return the recipes */ public NeeoRecipe[] getRecipes() { - final NeeoRecipe[] localRecipes = recipes; - return localRecipes == null ? new NeeoRecipe[0] : localRecipes; + return recipes; } /** @@ -58,12 +54,12 @@ public class NeeoRecipes { */ @Nullable public NeeoRecipe getRecipe(String key) { - if (recipes == null || StringUtils.isEmpty(key)) { + if (key.isEmpty()) { return null; } - for (NeeoRecipe recipe : getRecipes()) { - if (StringUtils.equalsIgnoreCase(key, recipe.getKey())) { + for (NeeoRecipe recipe : recipes) { + if (key.equalsIgnoreCase(recipe.getKey())) { return recipe; } } @@ -79,13 +75,12 @@ public class NeeoRecipes { */ @Nullable public NeeoRecipe getRecipeByScenarioKey(String key, String type) { - if (recipes == null || StringUtils.isEmpty(key)) { + if (key.isEmpty()) { return null; } - for (NeeoRecipe recipe : getRecipes()) { - if (StringUtils.equalsIgnoreCase(key, recipe.getScenarioKey()) - && StringUtils.equalsIgnoreCase(type, recipe.getType())) { + for (NeeoRecipe recipe : recipes) { + if (key.equalsIgnoreCase(recipe.getScenarioKey()) && type.equalsIgnoreCase(recipe.getType())) { return recipe; } } @@ -100,12 +95,12 @@ public class NeeoRecipes { */ @Nullable public NeeoRecipe getRecipeByName(String name) { - if (recipes == null || StringUtils.isEmpty(name)) { + if (name.isEmpty()) { return null; } - for (NeeoRecipe recipe : getRecipes()) { - if (StringUtils.equalsIgnoreCase(name, recipe.getName())) { + for (NeeoRecipe recipe : recipes) { + if (name.equalsIgnoreCase(recipe.getName())) { return recipe; } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoRooms.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoRooms.java index 877c6ff7215..f40999ee8c8 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoRooms.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoRooms.java @@ -15,7 +15,6 @@ package org.openhab.binding.neeo.internal.models; import java.util.Arrays; import java.util.Objects; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -58,7 +57,7 @@ public class NeeoRooms { */ NeeoRoom getRoom(String key) { for (NeeoRoom room : getRooms()) { - if (StringUtils.equalsIgnoreCase(key, room.getKey())) { + if (key.equalsIgnoreCase(room.getKey())) { return room; } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoScenarios.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoScenarios.java index e854bcbd129..ca816d0154c 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoScenarios.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/models/NeeoScenarios.java @@ -15,7 +15,6 @@ package org.openhab.binding.neeo.internal.models; import java.util.Arrays; import java.util.Objects; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -59,7 +58,7 @@ public class NeeoScenarios { @Nullable public NeeoScenario getScenario(String key) { for (NeeoScenario scenario : getScenarios()) { - if (StringUtils.equalsIgnoreCase(key, scenario.getKey())) { + if (key.equalsIgnoreCase(scenario.getKey())) { return scenario; } } diff --git a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/net/HttpResponse.java b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/net/HttpResponse.java index 909dddaeb8d..42489786f1a 100644 --- a/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/net/HttpResponse.java +++ b/bundles/org.openhab.binding.neeo/src/main/java/org/openhab/binding/neeo/internal/net/HttpResponse.java @@ -21,7 +21,6 @@ import java.util.Objects; import javax.ws.rs.core.Response; -import org.apache.commons.io.IOUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -59,7 +58,7 @@ public class HttpResponse { if (response.hasEntity()) { InputStream is = response.readEntity(InputStream.class); - contents = IOUtils.toByteArray(is); + contents = is.readAllBytes(); } else { contents = null; } diff --git a/bundles/org.openhab.binding.neeo/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.neeo/src/main/resources/OH-INF/thing/thing-types.xml index 6a4d92ad2c7..30c3b26655f 100644 --- a/bundles/org.openhab.binding.neeo/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.neeo/src/main/resources/OH-INF/thing/thing-types.xml @@ -30,7 +30,6 @@ Comma delimited list of URLs to forward NEEO brain actions to - true true