You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/04/30 19:18:36 UTC

[tomcat] branch master updated: Refactor. Narrow scope of try block.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 42aaf6d  Refactor. Narrow scope of try block.
42aaf6d is described below

commit 42aaf6d2d2370349c514cbe3611d16e384576243
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Apr 30 17:20:11 2019 +0100

    Refactor. Narrow scope of try block.
---
 java/org/apache/coyote/http2/Stream.java | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java
index 21304d9..408a144 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -273,8 +273,8 @@ class Stream extends AbstractStream implements HeaderEmitter {
                 throw new CloseNowException(sm.getString("stream.notWritable",
                         getConnectionId(), getIdentifier()));
             }
-            try {
-                if (block) {
+            if (block) {
+                try {
                     long writeTimeout = handler.getProtocol().getStreamWriteTimeout();
                     if (writeTimeout < 0) {
                         wait();
@@ -295,14 +295,14 @@ class Stream extends AbstractStream implements HeaderEmitter {
                         streamOutputBuffer.reset = se;
                         throw new CloseNowException(msg, se);
                     }
-                } else {
-                    return 0;
+                } catch (InterruptedException e) {
+                    // Possible shutdown / rst or similar. Use an IOException to
+                    // signal to the client that further I/O isn't possible for this
+                    // Stream.
+                    throw new IOException(e);
                 }
-            } catch (InterruptedException e) {
-                // Possible shutdown / rst or similar. Use an IOException to
-                // signal to the client that further I/O isn't possible for this
-                // Stream.
-                throw new IOException(e);
+            } else {
+                return 0;
             }
         }
         int allocation;


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