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 ff802b3b32 Clean-up - formatting. No functional change.
ff802b3b32 is described below

commit ff802b3b32ab673b5196d20df692239c66c3da52
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jul 23 10:49:51 2024 +0100

    Clean-up - formatting. No functional change.
---
 java/org/apache/coyote/http2/AbstractNonZeroStream.java    |  4 ++++
 java/org/apache/coyote/http2/AbstractStream.java           |  3 +++
 java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java |  4 ++--
 java/org/apache/coyote/http2/Http2UpgradeHandler.java      | 13 ++++++-------
 java/org/apache/coyote/http2/Stream.java                   |  8 ++++----
 java/org/apache/coyote/http2/StreamStateMachine.java       |  3 +--
 6 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/java/org/apache/coyote/http2/AbstractNonZeroStream.java 
b/java/org/apache/coyote/http2/AbstractNonZeroStream.java
index 333e33e5e3..406a112caa 100644
--- a/java/org/apache/coyote/http2/AbstractNonZeroStream.java
+++ b/java/org/apache/coyote/http2/AbstractNonZeroStream.java
@@ -51,7 +51,9 @@ abstract class AbstractNonZeroStream extends AbstractStream {
 
     /**
      * Check the frame type against the state
+     *
      * @param frameType the type
+     *
      * @throws Http2Exception if an error is detected
      */
     final void checkState(FrameType frameType) throws Http2Exception {
@@ -69,7 +71,9 @@ abstract class AbstractNonZeroStream extends AbstractStream {
 
     /**
      * Notify that some data has been received.
+     *
      * @param payloadSize the byte count
+     *
      * @throws Http2Exception if an error is detected
      */
     abstract void receivedData(int payloadSize) throws Http2Exception;
diff --git a/java/org/apache/coyote/http2/AbstractStream.java 
b/java/org/apache/coyote/http2/AbstractStream.java
index 35aa402730..9aaa6cd653 100644
--- a/java/org/apache/coyote/http2/AbstractStream.java
+++ b/java/org/apache/coyote/http2/AbstractStream.java
@@ -76,6 +76,7 @@ abstract class AbstractStream {
 
     /**
      * Set the window size for this stream.
+     *
      * @param windowSize the value
      */
     final void setWindowSize(long windowSize) {
@@ -168,6 +169,7 @@ abstract class AbstractStream {
 
     /**
      * Set the amount of requested resources.
+     *
      * @param connectionAllocationRequested the value
      */
     final void setConnectionAllocationRequested(int 
connectionAllocationRequested) {
@@ -187,6 +189,7 @@ abstract class AbstractStream {
 
     /**
      * Set the allocation made at the connection level.
+     *
      * @param connectionAllocationMade the value
      */
     final void setConnectionAllocationMade(int connectionAllocationMade) {
diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
index afdb2617a8..13f730b78d 100644
--- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
@@ -198,8 +198,8 @@ public class Http2AsyncUpgradeHandler extends 
Http2UpgradeHandler {
     void writeHeaders(Stream stream, MimeHeaders mimeHeaders, boolean 
endOfStream, int payloadSize) throws IOException {
         headerWriteLock.lock();
         try {
-            AsyncHeaderFrameBuffers headerFrameBuffers = 
(AsyncHeaderFrameBuffers) doWriteHeaders(stream, mimeHeaders,
-                    endOfStream, payloadSize);
+            AsyncHeaderFrameBuffers headerFrameBuffers =
+                    (AsyncHeaderFrameBuffers) doWriteHeaders(stream, 
mimeHeaders, endOfStream, payloadSize);
             if (headerFrameBuffers != null) {
                 socketWrapper.write(BlockingMode.SEMI_BLOCK, 
protocol.getWriteTimeout(), TimeUnit.MILLISECONDS, null,
                         SocketWrapperBase.COMPLETE_WRITE, 
applicationErrorCompletion,
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index db73830d45..fc7556711a 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -702,8 +702,7 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
         }
     }
 
-    void writeHeaders(Stream stream, MimeHeaders mimeHeaders, boolean 
endOfStream, int payloadSize)
-            throws IOException {
+    void writeHeaders(Stream stream, MimeHeaders mimeHeaders, boolean 
endOfStream, int payloadSize) throws IOException {
         // This ensures the Stream processing thread has control of the socket.
         Lock lock = socketWrapper.getLock();
         lock.lock();
@@ -960,7 +959,7 @@ class Http2UpgradeHandler extends AbstractStream implements 
InternalHttpUpgradeH
                     backLogStreams.add(stream);
 
                 } else {
-                     // The connection window has sufficient capacity for this 
reservation. Allocate the full amount.
+                    // The connection window has sufficient capacity for this 
reservation. Allocate the full amount.
                     allocation = reservation;
                     decrementWindowSize(allocation);
                 }
@@ -1614,10 +1613,10 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
                 }
             }
             /*
-             *  Need to process end of stream before calling 
processStreamOnContainerThread to avoid a race condition
-             *  where the container thread finishes before end of stream is 
processed, thinks the request hasn't been
-             *  fully read so issues a RST with error code 0 (NO_ERROR) to 
tell the client not to send the request body,
-             *  if any. This breaks tests and generates unnecessary RST 
messages for standard clients.
+             * Need to process end of stream before calling 
processStreamOnContainerThread to avoid a race condition
+             * where the container thread finishes before end of stream is 
processed, thinks the request hasn't been
+             * fully read so issues a RST with error code 0 (NO_ERROR) to tell 
the client not to send the request body,
+             * if any. This breaks tests and generates unnecessary RST 
messages for standard clients.
              */
             if (endOfStream) {
                 receivedEndOfStream(stream);
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 923f7c9c9c..7b289a2477 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -626,7 +626,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
     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.
+            // ByteBuffer to trigger a flow control error.
             return ZERO_LENGTH_BYTEBUFFER;
         }
         return inputBuffer.getInBuffer();
@@ -930,9 +930,9 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
             writeLock.lock();
             try {
                 /*
-                 * Need to ensure that there is exactly one call to flush even 
when there is no data to write. Too few calls
-                 * (i.e. zero) and the end of stream message is not sent for a 
completed asynchronous write. Too many calls
-                 * and the end of stream message is sent too soon and trailer 
headers are not sent.
+                 * Need to ensure that there is exactly one call to flush even 
when there is no data to write. Too few
+                 * calls (i.e. zero) and the end of stream message is not sent 
for a completed asynchronous write. Too
+                 * many calls and the end of stream message is sent too soon 
and trailer headers are not sent.
                  */
                 boolean dataInBuffer = buffer.position() > 0;
                 boolean flushed = false;
diff --git a/java/org/apache/coyote/http2/StreamStateMachine.java 
b/java/org/apache/coyote/http2/StreamStateMachine.java
index fcb41f2a45..be02a4de5a 100644
--- a/java/org/apache/coyote/http2/StreamStateMachine.java
+++ b/java/org/apache/coyote/http2/StreamStateMachine.java
@@ -84,8 +84,7 @@ class StreamStateMachine {
      */
     public synchronized void sendReset() {
         if (state == State.IDLE) {
-            throw new IllegalStateException(
-                    sm.getString("streamStateMachine.invalidReset", 
connectionId, streamId));
+            throw new 
IllegalStateException(sm.getString("streamStateMachine.invalidReset", 
connectionId, streamId));
         }
         if (state.canReset()) {
             stateChange(state, State.CLOSED_RST_TX);


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

Reply via email to