# HG changeset patch # User robm # Date 1495660027 -3600 # Node ID 2be29f802d94a14b45dbd5fb74eca1007cc3231d # Parent 54c960d8242853a4a2d27554492704abc46483a4 8180949: Correctly handle exception in TCPChannel.createConnection Reviewed-by: rriggs diff -r 54c960d82428 -r 2be29f802d94 jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java --- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java Tue May 23 23:25:26 2017 -0700 +++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java Wed May 24 22:07:07 2017 +0100 @@ -296,16 +296,12 @@ out.flush(); } } catch (IOException e) { + try { + conn.close(); + } catch (Exception ex) {} if (e instanceof RemoteException) { throw (RemoteException) e; } else { - if (conn != null - && e instanceof java.net.SocketTimeoutException) - { - try { - conn.close(); - } catch (Exception ex) {} - } throw new ConnectIOException( "error during JRMP connection establishment", e); }