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


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 8ed1de87e6 NPE check
8ed1de87e6 is described below

commit 8ed1de87e6e40483ba124b289735ac36107d7a28
Author: remm <[email protected]>
AuthorDate: Mon Jun 1 09:02:18 2026 +0200

    NPE check
---
 java/org/apache/coyote/Request.java | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/Request.java 
b/java/org/apache/coyote/Request.java
index 7cc084fad1..2a5021d589 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -1069,9 +1069,13 @@ public final class Request {
      * @return the protocol request ID
      */
     public String getProtocolRequestId() {
-        AtomicReference<String> ref = new AtomicReference<>();
-        hook.action(ActionCode.PROTOCOL_REQUEST_ID, ref);
-        return ref.get();
+        if (hook != null) {
+            AtomicReference<String> ref = new AtomicReference<>();
+            hook.action(ActionCode.PROTOCOL_REQUEST_ID, ref);
+            return ref.get();
+        } else {
+            return null;
+        }
     }
 
 
@@ -1081,9 +1085,13 @@ public final class Request {
      * @return the servlet connection
      */
     public ServletConnection getServletConnection() {
-        AtomicReference<ServletConnection> ref = new AtomicReference<>();
-        hook.action(ActionCode.SERVLET_CONNECTION, ref);
-        return ref.get();
+        if (hook != null) {
+            AtomicReference<ServletConnection> ref = new AtomicReference<>();
+            hook.action(ActionCode.SERVLET_CONNECTION, ref);
+            return ref.get();
+        } else {
+            return null;
+        }
     }
 
 


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

Reply via email to