changeset 51993:c0d05cf1d19d

8211107: LDAPS communication failure with jdk 1.8.0_181 Reviewed-by: chegar, coffeys, vtewari
author pkoppula
date Tue, 02 Oct 2018 21:38:54 +0530
parents 266a89a5d1af
children 7577686cc9bd
files src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java	Tue Oct 02 20:52:40 2018 -0700
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java	Tue Oct 02 21:38:54 2018 +0530
@@ -337,17 +337,17 @@
         // then reset the timeout.
         if (socket instanceof SSLSocket) {
             SSLSocket sslSocket = (SSLSocket) socket;
-            int socketTimeout = sslSocket.getSoTimeout();
             if (!IS_HOSTNAME_VERIFICATION_DISABLED) {
                 SSLParameters param = sslSocket.getSSLParameters();
                 param.setEndpointIdentificationAlgorithm("LDAPS");
                 sslSocket.setSSLParameters(param);
             }
             if (connectTimeout > 0) {
+                int socketTimeout = sslSocket.getSoTimeout();
                 sslSocket.setSoTimeout(connectTimeout); // reuse full timeout value
+                sslSocket.startHandshake();
+                sslSocket.setSoTimeout(socketTimeout);
             }
-            sslSocket.startHandshake();
-            sslSocket.setSoTimeout(socketTimeout);
         }
         return socket;
     }