Skip to content

Commit

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

Relative to #7722
* Local variables

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo authored May 25, 2020
1 parent 2176127 commit 8900180
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 8900180

Please sign in to comment.