diff --git a/bundles/org.openhab.binding.plugwise/src/main/java/org/openhab/binding/plugwise/internal/PlugwiseCommunicationContext.java b/bundles/org.openhab.binding.plugwise/src/main/java/org/openhab/binding/plugwise/internal/PlugwiseCommunicationContext.java index 82086973fc867..5aa94adb931e2 100644 --- a/bundles/org.openhab.binding.plugwise/src/main/java/org/openhab/binding/plugwise/internal/PlugwiseCommunicationContext.java +++ b/bundles/org.openhab.binding.plugwise/src/main/java/org/openhab/binding/plugwise/internal/PlugwiseCommunicationContext.java @@ -13,6 +13,8 @@ package org.openhab.binding.plugwise.internal; import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.util.Comparator; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; @@ -20,7 +22,6 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; -import org.apache.commons.io.IOUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.smarthome.io.transport.serial.PortInUseException; @@ -97,8 +98,22 @@ public void closeSerialPort() { SerialPort localSerialPort = serialPort; if (localSerialPort != null) { try { - IOUtils.closeQuietly(localSerialPort.getInputStream()); - IOUtils.closeQuietly(localSerialPort.getOutputStream()); + InputStream inputStream = localSerialPort.getInputStream(); + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + logger.debug("Error while closing the input stream: {}", e.getMessage()); + } + } + OutputStream outputStream = localSerialPort.getOutputStream(); + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + logger.debug("Error while closing the output stream: {}", e.getMessage()); + } + } localSerialPort.close(); serialPort = null; } catch (IOException e) {