Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50855
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 6 Mar 2011 07:33:58 +0000 (07:33 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 6 Mar 2011 07:33:58 +0000 (07:33 +0000)
Fix NPE on HttpServletRequest.logout() when debug logging is enabled.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1078412 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/authenticator/AuthenticatorBase.java
webapps/docs/changelog.xml

index 92a768f..e40587f 100644 (file)
@@ -686,9 +686,11 @@ public abstract class AuthenticatorBase extends ValveBase
                             Principal principal, String authType,
                             String username, String password) {
 
-        if (log.isDebugEnabled())
-            log.debug("Authenticated '" + principal.getName() + "' with type '"
-                + authType + "'");
+        if (log.isDebugEnabled()) {
+            String name = (principal == null) ? "none" : principal.getName(); 
+            log.debug("Authenticated '" + name + "' with type '" + authType +
+                    "'");
+        }
 
         // Cache the authentication information in our request
         request.setAuthType(authType);
index 05e1761..c7e43d3 100644 (file)
   Other
 -->
 <section name="Tomcat 7.0.11 (markt)">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        <bug>50855</bug>: Fix NPE on HttpServletRequest.logout() when debug
+        logging is enabled. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Jasper">
     <changelog>
       <fix>