JNDIRealm does not catch NullPointerException for Sun's LDAP provider
authorfunkman <funkman@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 20 May 2007 18:33:16 +0000 (18:33 +0000)
committerfunkman <funkman@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 20 May 2007 18:33:16 +0000 (18:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@539907 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/realm/JNDIRealm.java
webapps/docs/changelog.xml

index a5144c6..6b99df5 100644 (file)
@@ -808,6 +808,23 @@ public class JNDIRealm extends RealmBase {
                 // Authenticate the specified username if possible
                 principal = authenticate(context, username, credentials);
 
+            } catch (NullPointerException e) {
+                /* BZ 42449 - Kludge Sun's LDAP provider
+                   with broken SSL
+                */
+                // log the exception so we know it's there.
+                containerLog.warn(sm.getString("jndiRealm.exception"), e);
+
+                // close the connection so we know it will be reopened.
+                if (context != null)
+                    close(context);
+
+                // open a new directory context.
+                context = open();
+
+                // Try the authentication again.
+                principal = authenticate(context, username, credentials);
+
             } catch (CommunicationException e) {
 
                 // log the exception so we know it's there.
index 81a749b..c450011 100644 (file)
   <subsection name="Catalina">
     <changelog>
       <fix>
-         <bug>42444</bug>: prevent NPE 
+         <bug>42449</bug>:
+         JNDIRealm does not catch NullPointerException for Sun's
+         LDAP provider (See bug for details) (funkman)
+      </fix>
+      <fix>
+         <bug>42444</bug>: prevent NPE for AccessLogValve
          Patch provided by Nils Hammar (funkman)
       </fix>
       <fix>