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

markt 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 7ed943d63c Code review. InputBuffer is never null.
7ed943d63c is described below

commit 7ed943d63cd0adabca0119165f3874bf304fca84
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jul 23 11:58:07 2024 +0100

    Code review. InputBuffer is never null.
---
 java/org/apache/coyote/http2/Stream.java | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index bb983bf875..d6ace73a15 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -209,9 +209,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
         // Set the new state first since read and write both check this
         state.receivedReset();
         // Reads wait internally so need to call a method to break the wait()
-        if (inputBuffer != null) {
-            inputBuffer.receiveReset();
-        }
+        inputBuffer.receiveReset();
         cancelAllocationRequests();
     }
 
@@ -631,12 +629,6 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 
     @Override
     final ByteBuffer getInputByteBuffer() {
-        if (inputBuffer == null) {
-            // This must either be a push or an HTTP upgrade. Either way there
-            // should not be a request body so return a zero length ByteBuffer
-            // to trigger a flow control error.
-            return ZERO_LENGTH_BYTEBUFFER;
-        }
         return inputBuffer.getInBuffer();
     }
 
@@ -685,9 +677,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
                     Http2Error.PROTOCOL_ERROR);
         }
         state.receivedEndOfStream();
-        if (inputBuffer != null) {
-            inputBuffer.notifyEof();
-        }
+        inputBuffer.notifyEof();
     }
 
 
@@ -774,9 +764,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
                 handler.sendStreamReset(state, se);
 
                 cancelAllocationRequests();
-                if (inputBuffer != null) {
-                    inputBuffer.swallowUnread();
-                }
+                inputBuffer.swallowUnread();
             } catch (IOException ioe) {
                 ConnectionException ce =
                         new 
ConnectionException(sm.getString("stream.reset.fail", getConnectionId(), 
getIdAsString()),


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to