8211107: LDAPS communication failure with jdk 1.8.0_181
Reviewed-by: chegar, coffeys, vtewari
--- 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;
}