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

rmaucher 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 38f7bed268 NPE check
38f7bed268 is described below

commit 38f7bed26819f08efe49c07432bb9b0f608c0c86
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 0e6f29be3d..7e5cb766b8 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -1034,9 +1034,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;
+        }
     }
 
 
@@ -1046,9 +1050,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