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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new dc75d702b2 Avoid possible NPE
dc75d702b2 is described below

commit dc75d702b2dc350d695b1ae631b140bcb300af92
Author: remm <r...@apache.org>
AuthorDate: Thu Oct 10 15:50:10 2024 +0200

    Avoid possible NPE
---
 java/org/apache/catalina/valves/CrawlerSessionManagerValve.java | 6 ++++++
 webapps/docs/changelog.xml                                      | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java 
b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
index 491fcb17fd..932995a07d 100644
--- a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
+++ b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
@@ -175,6 +175,12 @@ public class CrawlerSessionManagerValve extends ValveBase {
     @Override
     public void invoke(Request request, Response response) throws IOException, 
ServletException {
 
+        if (request.getHost() == null || request.getContext() == null) {
+            // Request will have no session
+            getNext().invoke(request, response);
+            return;
+        }
+
         boolean isBot = false;
         String sessionId = null;
         String clientIp = request.getRemoteAddr();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 41002c87f2..1809e3445b 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -127,6 +127,10 @@
         <bug>69370</bug>: <code>DefaultServlet</code>'s HTML listing
         uses incorrect labels. (michaelo)
       </update>
+      <fix>
+        Avoid NPE in <code>CrawlerSessionManagerValve</code> for partially
+        mapped requests. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to