diff --git a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/EnvisalinkBridgeHandler.java b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/EnvisalinkBridgeHandler.java index 0b9cba93fa169..e51dc13c8b6ee 100644 --- a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/EnvisalinkBridgeHandler.java +++ b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/EnvisalinkBridgeHandler.java @@ -165,18 +165,9 @@ public void closeConnection() { logger.debug("closeConnection(): Closing Socket!"); tcpSocket.close(); tcpSocket = null; - } - if (tcpInput != null) { - logger.debug("closeConnection(): Closing Output Writer!"); - tcpInput.close(); tcpInput = null; - } - if (tcpOutput != null) { - logger.debug("closeConnection(): Closing Input Reader!"); - tcpOutput.close(); tcpOutput = null; } - setConnected(false); logger.debug("closeConnection(): Closed TCP Connection!"); } catch (IOException ioException) { diff --git a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/IT100BridgeHandler.java b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/IT100BridgeHandler.java index 8428baa8d33e2..d8d6ff04c74fe 100644 --- a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/IT100BridgeHandler.java +++ b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/IT100BridgeHandler.java @@ -19,7 +19,6 @@ import java.io.UnsupportedEncodingException; import java.util.TooManyListenersException; -import org.apache.commons.io.IOUtils; import org.eclipse.smarthome.core.thing.Bridge; import org.eclipse.smarthome.core.thing.ThingStatus; import org.eclipse.smarthome.io.transport.serial.PortInUseException; @@ -189,12 +188,20 @@ public void closeConnection() { serialPort.removeEventListener(); if (serialInput != null) { - IOUtils.closeQuietly(serialInput); + try { + serialInput.close(); + } catch (IOException e) { + logger.debug("Error while closing the input stream: {}", e.getMessage()); + } serialInput = null; } if (serialOutput != null) { - IOUtils.closeQuietly(serialOutput); + try { + serialOutput.close(); + } catch (IOException e) { + logger.debug("Error while closing the output stream: {}", e.getMessage()); + } serialOutput = null; } diff --git a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/TCPServerBridgeHandler.java b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/TCPServerBridgeHandler.java index f84a6a09ba48a..a6d71e6f441ed 100644 --- a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/TCPServerBridgeHandler.java +++ b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/TCPServerBridgeHandler.java @@ -172,16 +172,9 @@ public void closeConnection() { if (tcpSocket != null) { tcpSocket.close(); tcpSocket = null; - } - if (tcpInput != null) { - tcpInput.close(); tcpInput = null; - } - if (tcpOutput != null) { - tcpOutput.close(); tcpOutput = null; } - setConnected(false); logger.debug("closeConnection(): Closed TCP Connection!"); } catch (IOException ioException) {