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/04 13:57:15 UTC

httpcomponents-core git commit: No need to nest else clauses.

Repository: httpcomponents-core
Updated Branches:
  refs/heads/master e458ec98e -> d921a80c8


No need to nest else clauses.

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

Branch: refs/heads/master
Commit: d921a80c88dbff241a6286b48b378d98d76dca26
Parents: e458ec9
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 4 07:57:13 2018 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 4 07:57:13 2018 -0600

----------------------------------------------------------------------
 .../main/java/org/apache/hc/core5/http2/frame/RawFrame.java    | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d921a80c/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
index 8cf9455..d043b8c 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
@@ -65,12 +65,10 @@ public final class RawFrame extends Frame<ByteBuffer> {
                 }
                 dup.limit(dup.limit() - padding);
                 return dup;
-            } else {
-                return payload.duplicate();
             }
-        } else {
-            return null;
+            return payload.duplicate();
         }
+        return null;
     }
 
     @Override


Re: httpcomponents-core git commit: No need to nest else clauses.

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2018-08-04 at 13:57 +0000, ggregory@apache.org wrote:
> Repository: httpcomponents-core
> Updated Branches:
>   refs/heads/master e458ec98e -> d921a80c8
> 
> 
> No need to nest else clauses.
> 

Gary

Any chance you could enforce it though a style check rule, fix the
entire code base _once_ with a single commit?

We already have 8 such commits. And lost count how many I have
squashed.

Oleg


> Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-
> core/repo
> Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/co
> mmit/d921a80c
> Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree
> /d921a80c
> Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff
> /d921a80c
> 
> Branch: refs/heads/master
> Commit: d921a80c88dbff241a6286b48b378d98d76dca26
> Parents: e458ec9
> Author: Gary Gregory <gg...@apache.org>
> Authored: Sat Aug 4 07:57:13 2018 -0600
> Committer: Gary Gregory <gg...@apache.org>
> Committed: Sat Aug 4 07:57:13 2018 -0600
> 
> -------------------------------------------------------------------
> ---
>  .../main/java/org/apache/hc/core5/http2/frame/RawFrame.java    | 6
> ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> -------------------------------------------------------------------
> ---
> 
> 
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d921a
> 80c/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> -------------------------------------------------------------------
> ---
> diff --git a/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> b/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> index 8cf9455..d043b8c 100644
> --- a/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> +++ b/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> @@ -65,12 +65,10 @@ public final class RawFrame extends
> Frame<ByteBuffer> {
>                  }
>                  dup.limit(dup.limit() - padding);
>                  return dup;
> -            } else {
> -                return payload.duplicate();
>              }
> -        } else {
> -            return null;
> +            return payload.duplicate();
>          }
> +        return null;
>      }
>  
>      @Override
> 

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


Re: httpcomponents-core git commit: No need to nest else clauses.

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2018-08-04 at 13:57 +0000, ggregory@apache.org wrote:
> Repository: httpcomponents-core
> Updated Branches:
>   refs/heads/master e458ec98e -> d921a80c8
> 
> 
> No need to nest else clauses.
> 

Gary

Any chance you could enforce it though a style check rule, fix the
entire code base _once_ with a single commit?

We already have 8 such commits. And lost count how many I have
squashed.

Oleg


> Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-
> core/repo
> Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/co
> mmit/d921a80c
> Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree
> /d921a80c
> Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff
> /d921a80c
> 
> Branch: refs/heads/master
> Commit: d921a80c88dbff241a6286b48b378d98d76dca26
> Parents: e458ec9
> Author: Gary Gregory <gg...@apache.org>
> Authored: Sat Aug 4 07:57:13 2018 -0600
> Committer: Gary Gregory <gg...@apache.org>
> Committed: Sat Aug 4 07:57:13 2018 -0600
> 
> -------------------------------------------------------------------
> ---
>  .../main/java/org/apache/hc/core5/http2/frame/RawFrame.java    | 6
> ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> -------------------------------------------------------------------
> ---
> 
> 
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d921a
> 80c/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> -------------------------------------------------------------------
> ---
> diff --git a/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> b/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> index 8cf9455..d043b8c 100644
> --- a/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> +++ b/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
> @@ -65,12 +65,10 @@ public final class RawFrame extends
> Frame<ByteBuffer> {
>                  }
>                  dup.limit(dup.limit() - padding);
>                  return dup;
> -            } else {
> -                return payload.duplicate();
>              }
> -        } else {
> -            return null;
> +            return payload.duplicate();
>          }
> +        return null;
>      }
>  
>      @Override
>