Skip to content

Commit

Permalink
[plugwise] Removed dependency on 'org.apache.commons.io.IOUtils' (ope…
Browse files Browse the repository at this point in the history
…nhab#7734)

* [plugwise] Removed dependency on 'org.apache.commons.io.IOUtils'

Relative to openhab#7722
* Local variables

Signed-off-by: Laurent Garnier <[email protected]>
  • Loading branch information
lolodomo authored and markus7017 committed Sep 18, 2020
1 parent 1a02aff commit f9bcbb0
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
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;
import java.util.concurrent.PriorityBlockingQueue;
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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit f9bcbb0

Please sign in to comment.