Blame SOURCES/jdk8275535-rh2053256-ldap_auth.patch

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