This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 3b08f70fe0ba12b48dd9756b3eb7f506b83210e6
Author: opencode <[email protected]>
AuthorDate: Wed Oct 7 11:48:13 2026 +0200

    Make guessLocaleFromSession null tolerant in SessionUtils
    
    The org.apache.catalina.Session overload dereferenced its argument
    immediately, throwing a NullPointerException for a null argument even
    though its documented return contract covers the undeterminable case
    and the parallel guessUserFromSession(Session) method returns null for
    a null argument.
    
    Return null for a null argument, consistent with the sibling method.
    The defect is not reachable from the current callers in the Manager
    web application; this aligns the public utility behaviour.
---
 java/org/apache/catalina/manager/util/SessionUtils.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/java/org/apache/catalina/manager/util/SessionUtils.java 
b/java/org/apache/catalina/manager/util/SessionUtils.java
index a0b01eea5d..a4caac73cb 100644
--- a/java/org/apache/catalina/manager/util/SessionUtils.java
+++ b/java/org/apache/catalina/manager/util/SessionUtils.java
@@ -68,6 +68,9 @@ public class SessionUtils {
      * @return the locale, or {@code null} if it cannot be determined
      */
     public static Locale guessLocaleFromSession(final Session in_session) {
+        if (null == in_session) {
+            return null;
+        }
         return guessLocaleFromSession(in_session.getSession());
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to