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

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

commit 909207874267e3d372c443333ad067dfd7bacc7a
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 7441aacb8c..227d586b9e 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -210,9 +210,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();
     }
 
@@ -629,12 +627,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();
     }
 
@@ -683,9 +675,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
                     Http2Error.PROTOCOL_ERROR);
         }
         state.receivedEndOfStream();
-        if (inputBuffer != null) {
-            inputBuffer.notifyEof();
-        }
+        inputBuffer.notifyEof();
     }
 
 
@@ -772,9 +762,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