Blame SOURCES/jdk8275535-rh2053256-ldap_auth.patch

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