Skip to content

Commit

Permalink
[oceanic] Removed dependency on 'org.apache.commons.io.IOUtils'
Browse files Browse the repository at this point in the history
Relative to openhab#7722

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo committed May 22, 2020
1 parent efc84f1 commit c870a9b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.ThingStatus;
Expand Down Expand Up @@ -83,8 +82,18 @@ public void initialize() {
public void dispose() {
NetworkOceanicBindingConfiguration config = getConfigAs(NetworkOceanicBindingConfiguration.class);

IOUtils.closeQuietly(inputStream);
IOUtils.closeQuietly(outputStream);
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e1) {
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e1) {
}
}
if (socket != null) {
try {
socket.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Arrays;
import java.util.Enumeration;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.ThingStatus;
Expand Down Expand Up @@ -149,8 +148,18 @@ public void dispose() {
}
}

IOUtils.closeQuietly(inputStream);
IOUtils.closeQuietly(outputStream);
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e1) {
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e1) {
}
}
if (serialPort != null) {
serialPort.close();
}
Expand Down Expand Up @@ -224,7 +233,10 @@ public void interrupt() {
logger.trace("Interrupting the SerialPortReader");
interrupted = true;
super.interrupt();
IOUtils.closeQuietly(inputStream);
try {
inputStream.close();
} catch (IOException e) {
}
}

@Override
Expand Down

0 comments on commit c870a9b

Please sign in to comment.