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 5a83f6d6dc Add null checks for consistency
5a83f6d6dc is described below
commit 5a83f6d6dc848b282c8eb2fa472812983f62835e
Author: remm <[email protected]>
AuthorDate: Fri May 15 10:53:22 2026 +0200
Add null checks for consistency
The rest of the method checks for null, so it is indeed inconsistent.
---
java/org/apache/tomcat/util/net/SocketWrapperBase.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index 4ce8ff5dc8..638c5751a1 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -1631,7 +1631,9 @@ public abstract class SocketWrapperBase<E> {
CompletionHandler<Long,? super A> handler) {
IOException ioe = getError();
if (ioe != null) {
- handler.failed(ioe, attachment);
+ if (handler != null) {
+ handler.failed(ioe, attachment);
+ }
return CompletionState.ERROR;
}
if (timeout == -1) {
@@ -1648,11 +1650,15 @@ public abstract class SocketWrapperBase<E> {
if (block == BlockingMode.BLOCK || block == BlockingMode.SEMI_BLOCK) {
try {
if (read ? !readPending.tryAcquire(timeout, unit) :
!writePending.tryAcquire(timeout, unit)) {
- handler.failed(new SocketTimeoutException(), attachment);
+ if (handler != null) {
+ handler.failed(new SocketTimeoutException(),
attachment);
+ }
return CompletionState.ERROR;
}
} catch (InterruptedException e) {
- handler.failed(e, attachment);
+ if (handler != null) {
+ handler.failed(e, attachment);
+ }
return CompletionState.ERROR;
}
} else {
@@ -1660,7 +1666,9 @@ public abstract class SocketWrapperBase<E> {
if (block == BlockingMode.NON_BLOCK) {
return CompletionState.NOT_DONE;
} else {
- handler.failed(read ? new ReadPendingException() : new
WritePendingException(), attachment);
+ if (handler != null) {
+ handler.failed(read ? new ReadPendingException() : new
WritePendingException(), attachment);
+ }
return CompletionState.ERROR;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]