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

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 4c19a89c52 Code review. InputBuffer is never null.
4c19a89c52 is described below

commit 4c19a89c5288e336ea1498fd5288d38268cf0e89
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 | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 7b289a2477..bf415b74d9 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -204,9 +204,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();
     }
 
@@ -624,11 +622,6 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 
     @Override
     final ByteBuffer getInputByteBuffer() {
-        if (inputBuffer == null) {
-            // This must either be an HTTP upgrade. 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();
     }
 
@@ -677,9 +670,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
                     Http2Error.PROTOCOL_ERROR);
         }
         state.receivedEndOfStream();
-        if (inputBuffer != null) {
-            inputBuffer.notifyEof();
-        }
+        inputBuffer.notifyEof();
     }
 
 
@@ -761,9 +752,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