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

remm 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 132912f7c2 Check for null
132912f7c2 is described below

commit 132912f7c26a3b63e238c5a5a45a736a8fe82889
Author: remm <[email protected]>
AuthorDate: Mon Mar 9 17:00:52 2026 +0100

    Check for null
    
    Since reset on close sets the engine to null, improve checks a little.
---
 java/org/apache/tomcat/util/net/SecureNioChannel.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java 
b/java/org/apache/tomcat/util/net/SecureNioChannel.java
index 44ddfa5442..245b45c4ae 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -616,7 +616,8 @@ public class SecureNioChannel extends NioChannel {
     @Override
     public int read(ByteBuffer dst) throws IOException {
         // are we in the middle of closing or closed?
-        if (closing || closed) {
+        SSLEngine sslEngine = this.sslEngine;
+        if (closing || closed || sslEngine == null) {
             return -1;
         }
         // did we finish our handshake?
@@ -703,7 +704,8 @@ public class SecureNioChannel extends NioChannel {
     @Override
     public long read(ByteBuffer[] dsts, int offset, int length) throws 
IOException {
         // are we in the middle of closing or closed?
-        if (closing || closed) {
+        SSLEngine sslEngine = this.sslEngine;
+        if (closing || closed || sslEngine == null) {
             return -1;
         }
         // did we finish our handshake?
@@ -834,7 +836,8 @@ public class SecureNioChannel extends NioChannel {
             return sc.write(src);
         } else {
             // Are we closing or closed?
-            if (closing || closed) {
+            SSLEngine sslEngine = this.sslEngine;
+            if (closing || closed || sslEngine == null) {
                 throw new IOException(sm.getString("channel.nio.ssl.closing"));
             }
 
@@ -877,7 +880,8 @@ public class SecureNioChannel extends NioChannel {
     public long write(ByteBuffer[] srcs, int offset, int length) throws 
IOException {
         checkInterruptStatus();
         // Are we closing or closed?
-        if (closing || closed) {
+        SSLEngine sslEngine = this.sslEngine;
+        if (closing || closed || sslEngine == null) {
             throw new IOException(sm.getString("channel.nio.ssl.closing"));
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to