This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 031115ba15 Add null checks for consistency
031115ba15 is described below
commit 031115ba15f06e7a2d2703d0403bdc5227ab222c
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 8a9b71a9dc..76a95c0e5e 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -1700,7 +1700,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) {
@@ -1717,11 +1719,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 {
@@ -1729,7 +1735,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]