4ef53b
diff --git openjdk.orig/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java openjdk/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java
4ef53b
index cf4becb7db..4ab2ac0a31 100644
4ef53b
--- openjdk.orig/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java
4ef53b
+++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java
4ef53b
@@ -189,6 +189,10 @@ final public class LdapCtxFactory implements ObjectFactory, InitialContextFactor
4ef53b
                     ctx = getLdapCtxFromUrl(
4ef53b
                             r.getDomainName(), url, new LdapURL(u), env);
4ef53b
                     return ctx;
4ef53b
+                } catch (AuthenticationException e) {
4ef53b
+                    // do not retry on a different endpoint to avoid blocking
4ef53b
+                    // the user if authentication credentials are wrong.
4ef53b
+                    throw e;
4ef53b
                 } catch (NamingException e) {
4ef53b
                     // try the next element
4ef53b
                     lastException = e;
4ef53b
@@ -241,6 +245,10 @@ final public class LdapCtxFactory implements ObjectFactory, InitialContextFactor
4ef53b
         for (String u : urls) {
4ef53b
             try {
4ef53b
                 return getUsingURL(u, env);
4ef53b
+            } catch (AuthenticationException e) {
4ef53b
+                // do not retry on a different URL to avoid blocking
4ef53b
+                // the user if authentication credentials are wrong.
4ef53b
+                throw e;
4ef53b
             } catch (NamingException e) {
4ef53b
                 ex = e;
4ef53b
             }