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 controlSocket = null;
|
||||
if (tunnelForward) {
|
||||
LocalServerSocket localServerSocket = new LocalServerSocket(socketName);
|
||||
try {
|
||||
try (LocalServerSocket localServerSocket = new LocalServerSocket(socketName)) {
|
||||
videoSocket = localServerSocket.accept();
|
||||
if (sendDummyByte) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
localServerSocket.close();
|
||||
}
|
||||
} else {
|
||||
videoSocket = connect(socketName);
|
||||
|
|
Loading…
Reference in a new issue