diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java index cf4becb7dbd..12f1b844928 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java @@ -189,6 +189,10 @@ private static DirContext getUsingURL(String url, Hashtable env) ctx = getLdapCtxFromUrl( r.getDomainName(), url, new LdapURL(u), env); return ctx; + } catch (AuthenticationException e) { + // do not retry on a different endpoint to avoid blocking + // the user if authentication credentials are wrong. + throw e; } catch (NamingException e) { // try the next element lastException = e; @@ -241,6 +245,10 @@ private static DirContext getUsingURLs(String[] urls, Hashtable env) for (String u : urls) { try { return getUsingURL(u, env); + } catch (AuthenticationException e) { + // do not retry on a different endpoint to avoid blocking + // the user if authentication credentials are wrong. + throw e; } catch (NamingException e) { ex = e; }