From 60dcc4fd9517692b714e784f0d115c8a71a2e197 Mon Sep 17 00:00:00 2001 From: robm Date: Wed, 24 May 2017 17:25:45 +0100 Subject: [PATCH] 8175131: sun.rmi.transport.tcp.TCPChannel.createConnection close connection on timeout Reviewed-by: rriggs, msheppar --- .../classes/sun/rmi/transport/tcp/TCPChannel.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java b/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java index dbce2cc51..018a1ef5a 100644 --- a/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java +++ b/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java @@ -298,11 +298,19 @@ public class TCPChannel implements Channel { out.flush(); } } catch (IOException e) { - if (e instanceof RemoteException) + if (e instanceof RemoteException) { throw (RemoteException) e; - else + } else { + if (conn != null + && e instanceof java.net.SocketTimeoutException) + { + try { + conn.close(); + } catch (Exception ex) {} + } throw new ConnectIOException( "error during JRMP connection establishment", e); + } } } else { try { -- GitLab