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 bf1b73df33 Add null checks for consistency
bf1b73df33 is described below
commit bf1b73df33379a1ad4baccf98076844f2c5adbb2
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 7880fc76af..877532fbd6 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -1632,7 +1632,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) {
@@ -1649,11 +1651,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 {
@@ -1661,7 +1667,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]