diff options
Diffstat (limited to 'jurt')
-rw-r--r-- | jurt/com/sun/star/lib/connections/socket/socketAcceptor.java | 8 | ||||
-rw-r--r-- | jurt/com/sun/star/lib/connections/socket/socketConnector.java | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java index 9fd8001262aa..4000a1d0a463 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java +++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java @@ -144,7 +144,7 @@ public final class socketAcceptor implements XAcceptor { } serv = server; } - Socket socket; + Socket socket = null; try { socket = serv.accept(); if (DEBUG) { @@ -165,6 +165,12 @@ public final class socketAcceptor implements XAcceptor { return new SocketConnection(acceptingDescription, socket); } catch(IOException e) { + if (socket != null) { + try { + socket.close(); + } catch(IOException ioException) { + } + } throw new ConnectionSetupException(e); } } diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java index e88f1040ac16..3d29e47f4f21 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java +++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java @@ -154,9 +154,11 @@ public final class socketConnector implements XConnector { con = new SocketConnection(connectionDescription, socket); } catch (IOException e) { - try { - socket.close(); - } catch(IOException ioException) { + if (socket != null) { + try { + socket.close(); + } catch(IOException ioException) { + } } throw new NoConnectException(e); } |