# HG changeset patch # User robm # Date 1561062001 0 # Node ID d3030613fab993661059a5455671d8117a5075ba # Parent 0f141453b9e04494174c9485a44c5f4ab3a2e0e2 8223727: com/sun/jndi/ldap/privconn/RunTest.java failed due to hang in LdapRequest.getReplyBer Reviewed-by: prappo diff -r 0f141453b9e0 -r d3030613fab9 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