Blame SOURCES/jdk8275535-rh2053256-ldap_auth.patch

840a84
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
840a84
index 70903206ea0..09956084cf9 100644
840a84
--- openjdk.orig/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java
840a84
+++ openjdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java
840a84
@@ -189,6 +189,10 @@ public final class LdapCtxFactory implements ObjectFactory, InitialContextFactor
840a84
                     ctx = getLdapCtxFromUrl(
840a84
                             r.getDomainName(), url, new LdapURL(u), env);
840a84
                     return ctx;
840a84
+                } catch (AuthenticationException e) {
840a84
+                    // do not retry on a different endpoint to avoid blocking
840a84
+                    // the user if authentication credentials are wrong.
840a84
+                    throw e;
840a84
                 } catch (NamingException e) {
840a84
                     // try the next element
840a84
                     lastException = e;
840a84
@@ -241,6 +245,10 @@ public final class LdapCtxFactory implements ObjectFactory, InitialContextFactor
840a84
         for (String u : urls) {
840a84
             try {
840a84
                 return getUsingURL(u, env);
840a84
+            } catch (AuthenticationException e) {
840a84
+                // do not retry on a different URL to avoid blocking
840a84
+                // the user if authentication credentials are wrong.
840a84
+                throw e;
840a84
             } catch (NamingException e) {
840a84
                 ex = e;
840a84
             }