This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new a2aaab004f Avoid possible NPE
a2aaab004f is described below
commit a2aaab004fc52acfe0025f58ab95d23735f03cff
Author: remm <[email protected]>
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 2c27e5c9da..7fa1fab682 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -138,6 +138,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: [email protected]
For additional commands, e-mail: [email protected]