Skip to content

Commit

Permalink
[nibeheatpump] Removed dependency on 'org.apache.commons.io.IOUtils' (o…
Browse files Browse the repository at this point in the history
…penhab#7738)

Relative to openhab#7722

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo authored and andrewfg committed Aug 31, 2020
1 parent 38ee967 commit 30e7905
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.List;
import java.util.TooManyListenersException;

import org.apache.commons.io.IOUtils;
import org.eclipse.smarthome.core.util.HexUtils;
import org.eclipse.smarthome.io.transport.serial.PortInUseException;
import org.eclipse.smarthome.io.transport.serial.SerialPort;
Expand Down Expand Up @@ -109,18 +108,28 @@ public void connect(NibeHeatPumpConfiguration configuration) throws NibeHeatPump
@Override
public void disconnect() {
logger.debug("Disconnecting");
serialPort.removeEventListener();
if (serialPort != null) {
serialPort.removeEventListener();
}
if (readerThread != null) {
logger.debug("Interrupt serial listener");
readerThread.interrupt();
}
if (out != null) {
logger.debug("Close serial out stream");
IOUtils.closeQuietly(out);
try {
out.close();
} catch (IOException e) {
logger.debug("Error while closing the output stream: {}", e.getMessage());
}
}
if (in != null) {
logger.debug("Close serial in stream");
IOUtils.closeQuietly(in);
try {
in.close();
} catch (IOException e) {
logger.debug("Error while closing the input stream: {}", e.getMessage());
}
}
if (serialPort != null) {
logger.debug("Close serial port");
Expand Down Expand Up @@ -163,7 +172,6 @@ public class SerialReader extends Thread implements SerialPortEventListener {
public void interrupt() {
interrupted = true;
super.interrupt();
IOUtils.closeQuietly(in);
}

@Override
Expand Down

0 comments on commit 30e7905

Please sign in to comment.