This is an automated email from the ASF dual-hosted git repository.
rmaucher 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 5a01a043d2 NPE check
5a01a043d2 is described below
commit 5a01a043d28333eed698f973960c6ce8e88b5c14
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 bde750f037..f9b8fbdec9 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -997,9 +997,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;
+ }
}
@@ -1009,9 +1013,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]