changeset 17165:3f350fe1bec8

8180949: Correctly handle exception in TCPChannel.createConnection Reviewed-by: rriggs
author robm
date Wed, 24 May 2017 22:07:07 +0100
parents e3446d4c7fd2
children 4e167bc5be91
files src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java	Tue May 23 23:25:26 2017 -0700
+++ b/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);
                 }