From 4d782fc1761b9105cd509968eb5c538b2d1a3346 Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 6 Mar 2011 07:33:58 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50855 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 | 8 +++++--- webapps/docs/changelog.xml | 8 ++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java b/java/org/apache/catalina/authenticator/AuthenticatorBase.java index 92a768f8f..e40587f5d 100644 --- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java +++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java @@ -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); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 05e176116..c7e43d37c 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -43,6 +43,14 @@ Other -->
+ + + + 50855: Fix NPE on HttpServletRequest.logout() when debug + logging is enabled. (markt) + + + -- 2.11.0