8223727: com/sun/jndi/ldap/privconn/RunTest.java failed due to hang in LdapRequest.getReplyBer
authorrobm
Thu, 20 Jun 2019 20:20:01 +0000
changeset 55449 d3030613fab9
parent 55448 0f141453b9e0
child 55450 79a7fc6c9bc7
8223727: com/sun/jndi/ldap/privconn/RunTest.java failed due to hang in LdapRequest.getReplyBer Reviewed-by: prappo
src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java	Thu Jun 20 16:15:10 2019 -0400
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java	Thu Jun 20 20:20:01 2019 +0000
@@ -411,6 +411,14 @@
     BerDecoder readReply(LdapRequest ldr) throws IOException, NamingException {
         BerDecoder rber;
 
+        // If socket closed, don't even try
+        synchronized (this) {
+            if (sock == null) {
+                throw new ServiceUnavailableException(host + ":" + port +
+                    "; socket closed");
+            }
+        }
+
         try {
             // if no timeout is set so we wait infinitely until
             // a response is received