8223727: com/sun/jndi/ldap/privconn/RunTest.java failed due to hang in LdapRequest.getReplyBer
Reviewed-by: prappo
--- 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