You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2020/01/01 13:27:53 UTC

[httpcomponents-core] branch master updated (332a1e3 -> 8511b22)

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

olegk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git.


 discard 332a1e3  Don't use plural names for enums
 discard 4eff05c  HTTPCORE-620: removed unnecessary rank attribute from IOSession.Status enum
     new c4a68cc  Don't use plural names for enums
     new 8511b22  HTTPCORE-620: removed unnecessary rank attribute from IOSession.Status enum

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (332a1e3)
            \
             N -- N -- N   refs/heads/master (8511b22)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java | 4 ++++
 1 file changed, 4 insertions(+)


[httpcomponents-core] 01/02: Don't use plural names for enums

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit c4a68cc663e0c30e03ff27af6fb4866a9fd6435f
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Tue Dec 31 21:58:32 2019 +0100

    Don't use plural names for enums
    
    Stick to the general convention that enum are singular only.
---
 .../apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java | 6 +++---
 .../apache/hc/core5/testing/classic/ClassicAuthenticationTest.java  | 4 ++--
 .../hc/core5/testing/classic/ClassicServerAndRequesterTest.java     | 4 ++--
 .../org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java    | 4 ++--
 .../apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java    | 4 ++--
 .../apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java   | 4 ++--
 .../org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java    | 4 ++--
 .../impl/bootstrap/{StandardFilters.java => StandardFilter.java}    | 2 +-
 .../org/apache/hc/core5/http/examples/AsyncServerFilterExample.java | 4 ++--
 .../apache/hc/core5/http/examples/ClassicServerFilterExample.java   | 4 ++--
 10 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
index 5d42e29..071fa74 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
@@ -40,7 +40,7 @@ import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
 import org.apache.hc.core5.http.impl.Http1StreamListener;
 import org.apache.hc.core5.http.impl.HttpProcessors;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.impl.nio.DefaultHttpRequestParserFactory;
 import org.apache.hc.core5.http.impl.nio.DefaultHttpResponseWriterFactory;
 import org.apache.hc.core5.http.impl.nio.ServerHttp1StreamDuplexerFactory;
@@ -375,10 +375,10 @@ public class H2ServerBootstrap {
             final NamedElementChain<AsyncFilterHandler> filterChainDefinition = new NamedElementChain<>();
             filterChainDefinition.addLast(
                     new TerminalAsyncServerFilter(new DefaultAsyncResponseExchangeHandlerFactory(registry)),
-                    StandardFilters.MAIN_HANDLER.name());
+                    StandardFilter.MAIN_HANDLER.name());
             filterChainDefinition.addFirst(
                     new AsyncServerExpectationFilter(),
-                    StandardFilters.EXPECT_CONTINUE.name());
+                    StandardFilter.EXPECT_CONTINUE.name());
 
             for (final FilterEntry<AsyncFilterHandler> entry: filters) {
                 switch (entry.postion) {
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
index 418b155..c14254d 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
@@ -47,7 +47,7 @@ import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
 import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
 import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.io.SocketConfig;
 import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
 import org.apache.hc.core5.http.io.entity.EntityUtils;
@@ -103,7 +103,7 @@ public class ClassicAuthenticationTest {
                                     .setSoTimeout(TIMEOUT)
                                     .build())
                     .register("*", new EchoHandler())
-                    .replaceFilter(StandardFilters.EXPECT_CONTINUE.name(), new AbstractHttpServerAuthFilter<String>(respondImmediately) {
+                    .replaceFilter(StandardFilter.EXPECT_CONTINUE.name(), new AbstractHttpServerAuthFilter<String>(respondImmediately) {
 
                         @Override
                         protected String parseChallengeResponse(
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
index 82b90e7..462cd8d 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
@@ -45,7 +45,7 @@ import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
 import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
 import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.io.HttpFilterChain;
 import org.apache.hc.core5.http.io.HttpFilterHandler;
 import org.apache.hc.core5.http.io.SocketConfig;
@@ -101,7 +101,7 @@ public class ClassicServerAndRequesterTest {
                             .setSoTimeout(TIMEOUT)
                             .build())
                     .register("*", new EchoHandler())
-                    .addFilterBefore(StandardFilters.MAIN_HANDLER.name(), "no-keep-alive", new HttpFilterHandler() {
+                    .addFilterBefore(StandardFilter.MAIN_HANDLER.name(), "no-keep-alive", new HttpFilterHandler() {
 
                         @Override
                         public void handle(
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java
index 3fec96f..554cf4d 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java
@@ -49,7 +49,7 @@ import org.apache.hc.core5.http.impl.bootstrap.AsyncRequesterBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.AsyncServerBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncRequester;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.message.BasicHttpRequest;
 import org.apache.hc.core5.http.nio.AsyncEntityProducer;
 import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
@@ -117,7 +117,7 @@ public class Http1AuthenticationTest {
                         }
 
                     })
-                    .replaceFilter(StandardFilters.EXPECT_CONTINUE.name(), new AbstractAsyncServerAuthFilter<String>(respondImmediately) {
+                    .replaceFilter(StandardFilter.EXPECT_CONTINUE.name(), new AbstractAsyncServerAuthFilter<String>(respondImmediately) {
 
                         @Override
                         protected String parseChallengeResponse(
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
index cee7786..484fa9d 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
@@ -52,7 +52,7 @@ import org.apache.hc.core5.http.impl.bootstrap.AsyncRequesterBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.AsyncServerBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncRequester;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.message.BasicHttpRequest;
 import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
 import org.apache.hc.core5.http.nio.AsyncDataConsumer;
@@ -127,7 +127,7 @@ public class Http1ServerAndRequesterTest {
                         }
 
                     })
-                    .addFilterBefore(StandardFilters.MAIN_HANDLER.name(), "no-keepalive", new AsyncFilterHandler() {
+                    .addFilterBefore(StandardFilter.MAIN_HANDLER.name(), "no-keepalive", new AsyncFilterHandler() {
 
                         @Override
                         public AsyncDataConsumer handle(
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java
index 33088c5..d7b0560 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java
@@ -353,10 +353,10 @@ public class AsyncServerBootstrap {
             final NamedElementChain<AsyncFilterHandler> filterChainDefinition = new NamedElementChain<>();
             filterChainDefinition.addLast(
                     new TerminalAsyncServerFilter(new DefaultAsyncResponseExchangeHandlerFactory(registry)),
-                    StandardFilters.MAIN_HANDLER.name());
+                    StandardFilter.MAIN_HANDLER.name());
             filterChainDefinition.addFirst(
                     new AsyncServerExpectationFilter(),
-                    StandardFilters.EXPECT_CONTINUE.name());
+                    StandardFilter.EXPECT_CONTINUE.name());
 
             for (final FilterEntry<AsyncFilterHandler> entry: filters) {
                 switch (entry.postion) {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
index 82a90b8..dbf5c20 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
@@ -345,10 +345,10 @@ public class ServerBootstrap {
                     new TerminalServerFilter(
                             handlerRegistry,
                             this.responseFactory != null ? this.responseFactory : DefaultClassicHttpResponseFactory.INSTANCE),
-                    StandardFilters.MAIN_HANDLER.name());
+                    StandardFilter.MAIN_HANDLER.name());
             filterChainDefinition.addFirst(
                     new HttpServerExpectationFilter(),
-                    StandardFilters.EXPECT_CONTINUE.name());
+                    StandardFilter.EXPECT_CONTINUE.name());
 
             for (final FilterEntry<HttpFilterHandler> entry: filters) {
                 switch (entry.postion) {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilters.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilter.java
similarity index 97%
rename from httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilters.java
rename to httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilter.java
index 9864901..65a0381 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilters.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilter.java
@@ -33,7 +33,7 @@ package org.apache.hc.core5.http.impl.bootstrap;
  * @see AsyncServerBootstrap
  * @see ServerBootstrap
  */
-public enum StandardFilters {
+public enum StandardFilter {
 
     EXPECT_CONTINUE, MAIN_HANDLER
 
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
index 8cce0da..fd8c6b0 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
@@ -39,7 +39,7 @@ import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.Message;
 import org.apache.hc.core5.http.impl.bootstrap.AsyncServerBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
 import org.apache.hc.core5.http.nio.AsyncDataConsumer;
 import org.apache.hc.core5.http.nio.AsyncEntityProducer;
@@ -81,7 +81,7 @@ public class AsyncServerFilterExample {
 
                 // Replace standard expect-continue handling with a custom auth filter
 
-                .replaceFilter(StandardFilters.EXPECT_CONTINUE.name(), new AbstractAsyncServerAuthFilter<String>(true) {
+                .replaceFilter(StandardFilter.EXPECT_CONTINUE.name(), new AbstractAsyncServerAuthFilter<String>(true) {
 
                     @Override
                     protected String parseChallengeResponse(
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
index 4bde8a5..2708b8a 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
@@ -38,7 +38,7 @@ import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.io.SocketConfig;
 import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
 import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.io.HttpFilterChain;
 import org.apache.hc.core5.http.io.HttpFilterHandler;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
@@ -71,7 +71,7 @@ public class ClassicServerFilterExample {
 
                 // Replace standard expect-continue handling with a custom auth filter
 
-                .replaceFilter(StandardFilters.EXPECT_CONTINUE.name(), new AbstractHttpServerAuthFilter<String>(false) {
+                .replaceFilter(StandardFilter.EXPECT_CONTINUE.name(), new AbstractHttpServerAuthFilter<String>(false) {
 
                     @Override
                     protected String parseChallengeResponse(


[httpcomponents-core] 02/02: HTTPCORE-620: removed unnecessary rank attribute from IOSession.Status enum

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 8511b22e0776e63a66871a4bed512f289b004b51
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Tue Dec 31 17:48:22 2019 +0100

    HTTPCORE-620: removed unnecessary rank attribute from IOSession.Status enum
---
 .../java/org/apache/hc/core5/reactor/IOSession.java    | 18 ++++++++----------
 .../org/apache/hc/core5/reactor/ssl/SSLIOSession.java  |  9 ++++-----
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
index b8ca8c7..2985704 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
@@ -55,17 +55,15 @@ import org.apache.hc.core5.util.Timeout;
 @Internal
 public interface IOSession extends ByteChannel, SocketModalCloseable, Identifiable {
 
-    public enum Status {
-
-        ACTIVE(0),
-        CLOSING(1),
-        CLOSED(Integer.MAX_VALUE);
-
-        private Status(final int rank) {
-            this.rank = rank;
-        }
+    /**
+     * This enum represents a set of states I/O session transitions through
+     * during its life-span.
+     */
+    enum Status {
 
-        public final int rank;
+        ACTIVE,
+        CLOSING,
+        CLOSED
 
     }
 
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
index f4678ab..c135ea4 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
@@ -41,7 +41,6 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLEngineResult;
 import javax.net.ssl.SSLEngineResult.HandshakeStatus;
-import javax.net.ssl.SSLEngineResult.Status;
 import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLSession;
 
@@ -228,7 +227,7 @@ public class SSLIOSession implements IOSession {
 
         this.session.getLock().lock();
         try {
-            if (this.status.rank >= Status.CLOSING.rank) {
+            if (this.status.compareTo(Status.CLOSING) >= 0) {
                 return;
             }
             switch (this.sslMode) {
@@ -352,7 +351,7 @@ public class SSLIOSession implements IOSession {
                     }
                 }
 
-                if (this.status.rank >= Status.CLOSING.rank) {
+                if (this.status.compareTo(Status.CLOSING) >= 0) {
                     this.inPlain.release();
                 }
                 if (result.getStatus() != SSLEngineResult.Status.OK) {
@@ -404,7 +403,7 @@ public class SSLIOSession implements IOSession {
                 this.status = Status.CLOSED;
             }
             // Abnormal session termination
-            if (this.status.rank <= Status.CLOSING.rank && this.endOfStream
+            if (this.status.compareTo(Status.CLOSING) <= 0 && this.endOfStream
                     && this.sslEngine.getHandshakeStatus() == HandshakeStatus.NEED_UNWRAP) {
                 this.status = Status.CLOSED;
             }
@@ -632,7 +631,7 @@ public class SSLIOSession implements IOSession {
         this.session.getLock().lock();
         try {
             if (closeMode == CloseMode.GRACEFUL) {
-                if (this.status.rank >= Status.CLOSING.rank) {
+                if (this.status.compareTo(Status.CLOSING) >= 0) {
                     return;
                 }
                 this.status = Status.CLOSING;