You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2018/08/03 22:19:49 UTC

httpcomponents-core git commit: Don't need to nest else clauses; use ternary return instead of if/else; document empty block.

Repository: httpcomponents-core
Updated Branches:
  refs/heads/master c1d00413e -> c382e8825


Don't need to nest else clauses; use ternary return instead of if/else;
document empty block.

Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/c382e882
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/c382e882
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/c382e882

Branch: refs/heads/master
Commit: c382e8825109b2113be2b96ea9152922eee30d52
Parents: c1d0041
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Aug 3 16:19:44 2018 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Aug 3 16:19:44 2018 -0600

----------------------------------------------------------------------
 .../http/impl/nio/ServerHttp1StreamDuplexer.java  | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/c382e882/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
index af13bbf..334be3f 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
@@ -161,6 +161,7 @@ public class ServerHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpR
 
             @Override
             public void activate() throws HttpException, IOException {
+                // empty
             }
 
         };
@@ -443,11 +444,7 @@ public class ServerHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpR
         @Override
         public int write(final ByteBuffer src) throws IOException {
             synchronized (this) {
-                if (direct) {
-                    return channel.write(src);
-                } else {
-                    return 0;
-                }
+                return direct ? channel.write(src) : 0;
             }
         }
 
@@ -467,21 +464,16 @@ public class ServerHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpR
             synchronized (this) {
                 if (direct) {
                     return channel.abortGracefully();
-                } else {
-                    completed = true;
-                    return true;
                 }
+                completed = true;
+                return true;
             }
         }
 
         @Override
         public boolean isCompleted() {
             synchronized (this) {
-                if (direct) {
-                    return channel.isCompleted();
-                } else {
-                    return completed;
-                }
+                return direct ? channel.isCompleted() : completed;
             }
         }