changeset 55933:d3030613fab9

8223727: com/sun/jndi/ldap/privconn/RunTest.java failed due to hang in LdapRequest.getReplyBer Reviewed-by: prappo
author robm
date Thu, 20 Jun 2019 20:20:01 +0000
parents 0f141453b9e0
children 79a7fc6c9bc7
files src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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