Skip to content

Commit

Permalink
7.2.17
Browse files Browse the repository at this point in the history
Possible fix for File-Manager "Cannot parse null string" issue
  • Loading branch information
Osiris-Team committed May 7, 2023
1 parent e498138 commit f96ce9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>com.osiris.autoplug.client</groupId>
<artifactId>autoplug-client</artifactId>
<version>7.2.16</version>
<version>7.2.17</version>
<packaging>jar</packaging>

<name>AutoPlug-Client</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ public void setSmartRunnable(RunnableWithException runnable) {
public synchronized void setAndStartAsync(RunnableWithException runnable) {
if (this.thread != null)
this.thread.interrupt();
// Save instances to make sure NOT to close the wrong ones later.
Socket _socket = this.socket;
InputStream _in = this.in;
OutputStream _out = this.out;
this.thread = new Thread(() -> {
try {
runnable.run();
} catch (Exception e) {
if (!isClosing.get()) AL.warn(e); // Exceptions caused by close() are ignored
try {
close();
_close(Thread.currentThread(), _in, _out, _socket);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
Expand Down Expand Up @@ -272,8 +276,12 @@ public DataOutputStream getOut() {

@Override
public synchronized void close() throws Exception {
AL.debug(this.getClass(), "close()");
isClosing.set(true);
_close(thread, in, out, socket);
}

private void _close(Thread thread, InputStream in, OutputStream out, Socket socket) throws Exception {
AL.debug(this.getClass(), "_close()");
if (thread != null) thread.interrupt();
if (in != null) in.close();
if (out != null) out.close();
Expand Down

0 comments on commit f96ce9a

Please sign in to comment.