Use try-with-resources
Replace an explicit try-finally by a try-with-resources block.
This commit is contained in:
parent
4315be1648
commit
b22810b17c
1 changed files with 1 additions and 4 deletions
|
@ -61,8 +61,7 @@ public final class DesktopConnection implements Closeable {
|
||||||
LocalSocket videoSocket;
|
LocalSocket videoSocket;
|
||||||
LocalSocket controlSocket = null;
|
LocalSocket controlSocket = null;
|
||||||
if (tunnelForward) {
|
if (tunnelForward) {
|
||||||
LocalServerSocket localServerSocket = new LocalServerSocket(socketName);
|
try (LocalServerSocket localServerSocket = new LocalServerSocket(socketName)) {
|
||||||
try {
|
|
||||||
videoSocket = localServerSocket.accept();
|
videoSocket = localServerSocket.accept();
|
||||||
if (sendDummyByte) {
|
if (sendDummyByte) {
|
||||||
// send one byte so the client may read() to detect a connection error
|
// send one byte so the client may read() to detect a connection error
|
||||||
|
@ -76,8 +75,6 @@ public final class DesktopConnection implements Closeable {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
localServerSocket.close();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
videoSocket = connect(socketName);
|
videoSocket = connect(socketName);
|
||||||
|
|
Loading…
Reference in a new issue