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/11/24 19:05:24 UTC

[httpcomponents-core] branch 5.0.x updated (455a9df -> f5e3f4b)

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

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


    from 455a9df  Bug fix: Fixed ignoring maxResultLength in toString method of EntityUtils.
     new d668dc3  Updated Docker images and external compatibility tests
     new aa25464  Use try-with-resources.
     new 8db1013  Use diamonds.
     new b1ab793  Add missing @Override.
     new 02acf9c  Make better use of Map APIs.
     new d2df5fc  Remove redundant modifiers.
     new 1699ac4  Use Collections.addAll() API instead of loops.
     new b6cf5a6  Remote extra semicolons (;).
     new f5e3f4b  Document PR #232: Master try w res and more.

The 9 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:
 RELEASE_NOTES.txt                                  | 18 ++++++++++
 .../hc/core5/http2/examples/H2GreetingServer.java  |  2 +-
 httpcore5-testing/docker/BUILDING.txt              |  8 ++---
 httpcore5-testing/docker/nginx/Dockerfile          |  2 +-
 .../org/apache/hc/core5/testing/SocksProxy.java    |  2 +-
 .../http/io/support/TerminalServerFilter.java      |  2 +-
 .../core5/http/nio/entity/NoopEntityConsumer.java  |  6 ++--
 .../nio/support/BasicClientExchangeHandler.java    |  4 +--
 .../support/ImmediateResponseExchangeHandler.java  |  8 ++---
 .../apache/hc/core5/http/protocol/HttpContext.java |  2 +-
 .../java/org/apache/hc/core5/net/URIBuilder.java   |  4 +--
 .../java/org/apache/hc/core5/pool/LaxConnPool.java |  2 +-
 .../org/apache/hc/core5/reactor/IOSession.java     |  2 ++
 .../hc/core5/reactor/SingleCoreIOReactor.java      |  2 +-
 .../core5/reactor/SocksProxyProtocolHandler.java   |  2 +-
 .../org/apache/hc/core5/ssl/SSLContextBuilder.java |  9 ++---
 .../hc/core5/http/impl/nio/CodecTestUtils.java     |  5 +--
 .../core5/http/impl/nio/TestIdentityDecoder.java   | 20 +++--------
 .../http/impl/nio/TestLengthDelimitedDecoder.java  | 30 ++++------------
 .../hc/core5/http/message/TestMessageSupport.java  |  5 ++-
 .../apache/hc/core5/ssl/TestSSLContextBuilder.java | 42 +++++-----------------
 21 files changed, 67 insertions(+), 110 deletions(-)


[httpcomponents-core] 01/09: Updated Docker images and external compatibility tests

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

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

commit d668dc3e04386960ff2c3d11a7fe2f4652dd8fca
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sun Nov 22 15:40:51 2020 +0100

    Updated Docker images and external compatibility tests
---
 httpcore5-testing/docker/BUILDING.txt     | 8 ++++----
 httpcore5-testing/docker/nginx/Dockerfile | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/httpcore5-testing/docker/BUILDING.txt b/httpcore5-testing/docker/BUILDING.txt
index f687ec3..0daf38c 100644
--- a/httpcore5-testing/docker/BUILDING.txt
+++ b/httpcore5-testing/docker/BUILDING.txt
@@ -1,8 +1,8 @@
 Building Docker containers for compatibility tests
 ========================================================
 
-Remark: Docker containers have been developed and tested with Docker version 1.12.4, build 1564f02
-on Debian Linux 8.6
+Remark: Docker containers have been developed and tested with Docker version 19.03.8, build afacb8b7f0
+on Ubuntu 20.04
 
 Remark: omit sudo command if executing as root
 
@@ -23,5 +23,5 @@ sudo docker run --name my-hc-tests-httpbin -p 0.0.0.0:8082:80 -d hc-tests-httpbi
 Execute
 
 ---
-Http2CompatibilityTest http://localhost:8080 APACHE-HTTPD
-Http2CompatibilityTest http://localhost:8081 NGINX
\ No newline at end of file
+H2CompatibilityTest http://localhost:8080 APACHE-HTTPD
+H2CompatibilityTest http://localhost:8081 NGINX
\ No newline at end of file
diff --git a/httpcore5-testing/docker/nginx/Dockerfile b/httpcore5-testing/docker/nginx/Dockerfile
index a94e762..9d452e0 100644
--- a/httpcore5-testing/docker/nginx/Dockerfile
+++ b/httpcore5-testing/docker/nginx/Dockerfile
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM nginx:1.17
+FROM nginx:1.18
 MAINTAINER dev@hc.apache.org
 
 ENV var_dir /var/nginx


[httpcomponents-core] 09/09: Document PR #232: Master try w res and more.

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

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

commit f5e3f4bb43a543a043e57001abfd8342add4bfb1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 18:57:46 2020 -0500

    Document PR #232: Master try w res and more.
---
 RELEASE_NOTES.txt | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 2522197..bea9736 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,3 +1,21 @@
+Release 5.0.3
+------------------
+
+Change Log
+-------------------
+
+* PR #232: Master try w res and more.
+  - Use try-with-resources.
+  - Use diamonds.
+  - Add missing @Override.
+  - Make better use of Map APIs.
+  - Remove redundant modifiers. …
+  - Use Collections.addAll() API instead of loops.
+  - Remote extra semicolons (;).
+  Contributed by Gary Gregory <garydgregory at gmail.com>
+
+
+
 Release 5.0.2
 ------------------
 


[httpcomponents-core] 02/09: Use try-with-resources.

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

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

commit aa25464ddab417ce8456877376e2f1ff548f3973
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 10:42:13 2020 -0500

    Use try-with-resources.
---
 .../hc/core5/http/impl/nio/CodecTestUtils.java     |  5 +--
 .../core5/http/impl/nio/TestIdentityDecoder.java   | 20 +++--------
 .../http/impl/nio/TestLengthDelimitedDecoder.java  | 30 ++++------------
 .../apache/hc/core5/ssl/TestSSLContextBuilder.java | 40 +++++-----------------
 4 files changed, 19 insertions(+), 76 deletions(-)

diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/CodecTestUtils.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/CodecTestUtils.java
index 8128ce0..155a00f 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/CodecTestUtils.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/CodecTestUtils.java
@@ -50,8 +50,7 @@ class CodecTestUtils {
 
     public static String readFromFile(final File file) throws Exception {
         final FileInputStream filestream = new FileInputStream(file);
-        final InputStreamReader reader = new InputStreamReader(filestream);
-        try {
+        try (InputStreamReader reader = new InputStreamReader(filestream)) {
             final StringBuilder buffer = new StringBuilder();
             final char[] tmp = new char[2048];
             int l;
@@ -59,8 +58,6 @@ class CodecTestUtils {
                 buffer.append(tmp, 0, l);
             }
             return buffer.toString();
-        } finally {
-            reader.close();
         }
     }
 
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java
index 0df1f1d..40c81ec 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java
@@ -154,8 +154,7 @@ public class TestIdentityDecoder {
                 channel, inbuf, metrics);
 
         createTempFile();
-        final RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw")) {
             final FileChannel fchannel = testfile.getChannel();
             long pos = 0;
             while (!decoder.isCompleted()) {
@@ -166,8 +165,6 @@ public class TestIdentityDecoder {
             }
 
             Assert.assertEquals(testfile.length(), metrics.getBytesTransferred());
-        } finally {
-            testfile.close();
         }
         Assert.assertEquals("stuff; more stuff; a lot more stuff!",
             CodecTestUtils.readFromFile(this.tmpfile));
@@ -187,8 +184,7 @@ public class TestIdentityDecoder {
         Assert.assertEquals(7, i);
 
         createTempFile();
-        final RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw")) {
             final FileChannel fchannel = testfile.getChannel();
             long pos = 0;
             while (!decoder.isCompleted()) {
@@ -200,8 +196,6 @@ public class TestIdentityDecoder {
 
             // count everything except the initial 7 bytes that went to the session buffer
             Assert.assertEquals(testfile.length() - 7, metrics.getBytesTransferred());
-        } finally {
-            testfile.close();
         }
         Assert.assertEquals("stuff; more stuff; a lot more stuff!",
             CodecTestUtils.readFromFile(this.tmpfile));
@@ -267,8 +261,7 @@ public class TestIdentityDecoder {
         Assert.assertEquals(19, i);
 
         createTempFile();
-        final RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw")) {
             final FileChannel fchannel = testfile.getChannel();
             long pos = 0;
 
@@ -314,8 +307,6 @@ public class TestIdentityDecoder {
             Assert.assertEquals(-1, bytesRead);
             Assert.assertTrue(decoder.isCompleted());
             Assert.assertEquals(17, metrics.getBytesTransferred());
-        } finally {
-            testfile.close();
         }
         Assert.assertEquals("stuff; more stuff; a lot more stuff!",
                 CodecTestUtils.readFromFile(this.tmpfile));
@@ -332,16 +323,13 @@ public class TestIdentityDecoder {
                 channel, inbuf, metrics);
 
         createTempFile();
-        final RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw")) {
             Assert.assertEquals(0, testfile.length());
             final FileChannel fchannel = testfile.getChannel();
             try {
                 decoder.transfer(fchannel, 5, 10);
                 Assert.fail("expected IOException");
             } catch(final IOException iox) {}
-        } finally {
-            testfile.close();
         }
     }
 
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java
index 4ab31d4..a455ff5 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java
@@ -265,8 +265,7 @@ public class TestLengthDelimitedDecoder {
                 channel, inbuf, metrics, 36);
 
         createTempFile();
-        final RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw")) {
             final FileChannel fchannel = testfile.getChannel();
             long pos = 0;
             while (!decoder.isCompleted()) {
@@ -275,8 +274,6 @@ public class TestLengthDelimitedDecoder {
                     pos += bytesRead;
                 }
             }
-        } finally {
-            testfile.close();
         }
         Assert.assertEquals(this.tmpfile.length(), metrics.getBytesTransferred());
         Assert.assertEquals("stuff; more stuff; a lot more stuff!",
@@ -297,8 +294,7 @@ public class TestLengthDelimitedDecoder {
         Assert.assertEquals(7, i);
 
         createTempFile();
-        final RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw")) {
             final FileChannel fchannel = testfile.getChannel();
             long pos = 0;
             while (!decoder.isCompleted()) {
@@ -307,8 +303,6 @@ public class TestLengthDelimitedDecoder {
                     pos += bytesRead;
                 }
             }
-        } finally {
-            testfile.close();
         }
         Assert.assertEquals(this.tmpfile.length() - 7, metrics.getBytesTransferred());
         Assert.assertEquals("stuff; more stuff; a lot more stuff!",
@@ -375,8 +369,7 @@ public class TestLengthDelimitedDecoder {
         Assert.assertEquals(19, i);
 
         createTempFile();
-        final RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw")) {
             final FileChannel fchannel = testfile.getChannel();
             long pos = 0;
 
@@ -422,8 +415,6 @@ public class TestLengthDelimitedDecoder {
             Assert.assertEquals(-1, bytesRead);
             Assert.assertTrue(decoder.isCompleted());
             Assert.assertEquals(17, metrics.getBytesTransferred());
-        } finally {
-            testfile.close();
         }
         Assert.assertEquals("stuff; more stuff; a lot more stuff!",
                 CodecTestUtils.readFromFile(this.tmpfile));
@@ -440,8 +431,7 @@ public class TestLengthDelimitedDecoder {
                 channel, inbuf, metrics, 1);
 
         createTempFile();
-        final RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw")) {
             final FileChannel fchannel = testfile.getChannel();
             Assert.assertEquals(0, testfile.length());
             try {
@@ -449,8 +439,6 @@ public class TestLengthDelimitedDecoder {
                 Assert.fail("IOException should have been thrown");
             } catch(final IOException expected) {
             }
-        } finally {
-            testfile.close();
         }
     }
 
@@ -467,8 +455,7 @@ public class TestLengthDelimitedDecoder {
                 channel, inbuf, metrics, 16);
 
         createTempFile();
-        final RandomAccessFile testfile  = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile  = new RandomAccessFile(this.tmpfile, "rw")) {
             final FileChannel fchannel = testfile.getChannel();
 
             long bytesRead = decoder.transfer(fchannel, 0, 6);
@@ -485,8 +472,6 @@ public class TestLengthDelimitedDecoder {
             Assert.assertEquals(-1, bytesRead);
             Assert.assertTrue(decoder.isCompleted());
             Assert.assertEquals(16, metrics.getBytesTransferred());
-        } finally {
-            testfile.close();
         }
     }
 
@@ -588,14 +573,11 @@ public class TestLengthDelimitedDecoder {
                 channel, inbuf, metrics, 20);
 
         createTempFile();
-        final RandomAccessFile testfile  = new RandomAccessFile(this.tmpfile, "rw");
-        try {
+        try (RandomAccessFile testfile  = new RandomAccessFile(this.tmpfile, "rw")) {
             final FileChannel fchannel = testfile.getChannel();
             final long bytesRead = decoder.transfer(fchannel, 0, Integer.MAX_VALUE);
             Assert.assertEquals(10, bytesRead);
             decoder.transfer(fchannel, 0, Integer.MAX_VALUE);
-        } finally {
-            testfile.close();
         }
     }
 
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java b/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
index ee0e369..5ce874d 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
@@ -249,13 +249,10 @@ public class TestSSLContextBuilder {
         final Future<Boolean> future = this.executorService.submit(new Callable<Boolean>() {
             @Override
             public Boolean call() throws Exception {
-                final Socket socket = serverSocket.accept();
-                try {
+                try (Socket socket = serverSocket.accept()) {
                     final OutputStream outputStream = socket.getOutputStream();
                     outputStream.write(new byte[]{'H', 'i'});
                     outputStream.flush();
-                } finally {
-                    socket.close();
                 }
                 return Boolean.TRUE;
             }
@@ -298,11 +295,8 @@ public class TestSSLContextBuilder {
         this.executorService.submit(new Callable<Boolean>() {
             @Override
             public Boolean call() throws Exception {
-                final SSLSocket socket = (SSLSocket) serverSocket.accept();
-                try {
+                try (SSLSocket socket = (SSLSocket) serverSocket.accept()) {
                     socket.getSession();
-                } finally {
-                    socket.close();
                 }
                 return Boolean.FALSE;
             }
@@ -350,13 +344,10 @@ public class TestSSLContextBuilder {
         final Future<Boolean> future = this.executorService.submit(new Callable<Boolean>() {
             @Override
             public Boolean call() throws Exception {
-                final Socket socket = serverSocket.accept();
-                try {
+                try (Socket socket = serverSocket.accept()) {
                     final OutputStream outputStream = socket.getOutputStream();
                     outputStream.write(new byte[]{'H', 'i'});
                     outputStream.flush();
-                } finally {
-                    socket.close();
                 }
                 return Boolean.TRUE;
             }
@@ -473,11 +464,8 @@ public class TestSSLContextBuilder {
         this.executorService.submit(new Callable<Boolean>() {
             @Override
             public Boolean call() throws Exception {
-                final SSLSocket socket = (SSLSocket) serverSocket.accept();
-                try {
+                try (SSLSocket socket = (SSLSocket) serverSocket.accept()) {
                     socket.getSession();
-                } finally {
-                    socket.close();
                 }
                 return Boolean.FALSE;
             }
@@ -517,16 +505,13 @@ public class TestSSLContextBuilder {
         final Future<Principal> future = this.executorService.submit(new Callable<Principal>() {
             @Override
             public Principal call() throws Exception {
-                final SSLSocket socket = (SSLSocket) serverSocket.accept();
-                try {
+                try (SSLSocket socket = (SSLSocket) serverSocket.accept()) {
                     final SSLSession session = socket.getSession();
                     final Principal clientPrincipal = session.getPeerPrincipal();
                     final OutputStream outputStream = socket.getOutputStream();
                     outputStream.write(new byte[]{'H', 'i'});
                     outputStream.flush();
                     return clientPrincipal;
-                } finally {
-                    socket.close();
                 }
             }
         });
@@ -578,16 +563,13 @@ public class TestSSLContextBuilder {
         final Future<Principal> future = this.executorService.submit(new Callable<Principal>() {
             @Override
             public Principal call() throws Exception {
-                final SSLSocket socket = (SSLSocket) serverSocket.accept();
-                try {
+                try (SSLSocket socket = (SSLSocket) serverSocket.accept()) {
                     final SSLSession session = socket.getSession();
                     final Principal clientPrincipal = session.getPeerPrincipal();
                     final OutputStream outputStream = socket.getOutputStream();
                     outputStream.write(new byte[]{'H', 'i'});
                     outputStream.flush();
                     return clientPrincipal;
-                } finally {
-                    socket.close();
                 }
             }
         });
@@ -638,11 +620,8 @@ public class TestSSLContextBuilder {
         this.executorService.submit(new Callable<Boolean>() {
             @Override
             public Boolean call() throws Exception {
-                final SSLSocket socket = (SSLSocket) serverSocket.accept();
-                try {
+                try (SSLSocket socket = (SSLSocket) serverSocket.accept()) {
                     socket.getSession();
-                } finally {
-                    socket.close();
                 }
                 return Boolean.FALSE;
             }
@@ -689,11 +668,8 @@ public class TestSSLContextBuilder {
         this.executorService.submit(new Callable<Boolean>() {
             @Override
             public Boolean call() throws Exception {
-                final SSLSocket socket = (SSLSocket) serverSocket.accept();
-                try {
+                try (SSLSocket socket = (SSLSocket) serverSocket.accept()) {
                     socket.getSession();
-                } finally {
-                    socket.close();
                 }
                 return Boolean.FALSE;
             }


[httpcomponents-core] 06/09: Remove redundant modifiers.

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

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

commit d2df5fc99cd4a0d61ea22ebf856e7208116044e8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 11:43:16 2020 -0500

    Remove redundant modifiers.
    
    - All methods in a final class are already final.
    - All members of an interface are public.
    - All inner enums are static.
---
 .../org/apache/hc/core5/http/io/support/TerminalServerFilter.java | 2 +-
 .../org/apache/hc/core5/http/nio/entity/NoopEntityConsumer.java   | 6 +++---
 .../hc/core5/http/nio/support/BasicClientExchangeHandler.java     | 4 ++--
 .../core5/http/nio/support/ImmediateResponseExchangeHandler.java  | 8 ++++----
 .../main/java/org/apache/hc/core5/http/protocol/HttpContext.java  | 2 +-
 .../org/apache/hc/core5/reactor/SocksProxyProtocolHandler.java    | 2 +-
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/support/TerminalServerFilter.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/support/TerminalServerFilter.java
index 5955f68..b10e21a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/support/TerminalServerFilter.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/support/TerminalServerFilter.java
@@ -64,7 +64,7 @@ public final class TerminalServerFilter implements HttpFilterHandler {
     }
 
     @Override
-    public final void handle(
+    public void handle(
             final ClassicHttpRequest request,
             final HttpFilterChain.ResponseTrigger responseTrigger,
             final HttpContext context,
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/NoopEntityConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/NoopEntityConsumer.java
index b2188f1..d3132f9 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/NoopEntityConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/NoopEntityConsumer.java
@@ -47,7 +47,7 @@ public final class NoopEntityConsumer implements AsyncEntityConsumer<Void> {
     private volatile FutureCallback<Void> resultCallback;
 
     @Override
-    public final void streamStart(
+    public void streamStart(
             final EntityDetails entityDetails,
             final FutureCallback<Void> resultCallback) throws IOException, HttpException {
         this.resultCallback = resultCallback;
@@ -59,11 +59,11 @@ public final class NoopEntityConsumer implements AsyncEntityConsumer<Void> {
     }
 
     @Override
-    public final void consume(final ByteBuffer src) throws IOException {
+    public void consume(final ByteBuffer src) throws IOException {
     }
 
     @Override
-    public final void streamEnd(final List<? extends Header> trailers) throws IOException {
+    public void streamEnd(final List<? extends Header> trailers) throws IOException {
         if (resultCallback != null) {
             resultCallback.completed(null);
         }
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/BasicClientExchangeHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/BasicClientExchangeHandler.java
index 0cf0f7a..3296afc 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/BasicClientExchangeHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/BasicClientExchangeHandler.java
@@ -175,7 +175,7 @@ public final class BasicClientExchangeHandler<T> implements AsyncClientExchangeH
     }
 
     @Override
-    public final void failed(final Exception cause) {
+    public void failed(final Exception cause) {
         try {
             requestProducer.failed(cause);
             responseConsumer.failed(cause);
@@ -198,7 +198,7 @@ public final class BasicClientExchangeHandler<T> implements AsyncClientExchangeH
     }
 
     @Override
-    public final void releaseResources() {
+    public void releaseResources() {
     }
 
 }
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java
index cc5e214..d165451 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/ImmediateResponseExchangeHandler.java
@@ -91,23 +91,23 @@ public final class ImmediateResponseExchangeHandler implements AsyncServerExchan
     }
 
     @Override
-    public final int available() {
+    public int available() {
         return responseProducer.available();
     }
 
     @Override
-    public final void produce(final DataStreamChannel channel) throws IOException {
+    public void produce(final DataStreamChannel channel) throws IOException {
         responseProducer.produce(channel);
     }
 
     @Override
-    public final void failed(final Exception cause) {
+    public void failed(final Exception cause) {
         responseProducer.failed(cause);
         releaseResources();
     }
 
     @Override
-    public final void releaseResources() {
+    public void releaseResources() {
         responseProducer.releaseResources();
     }
 
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpContext.java b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpContext.java
index c0e0651..0d7db11 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpContext.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpContext.java
@@ -50,7 +50,7 @@ import org.apache.hc.core5.http.ProtocolVersion;
 public interface HttpContext {
 
     /** The prefix reserved for use by HTTP components. "http." */
-    public static final String RESERVED_PREFIX  = "http.";
+    String RESERVED_PREFIX  = "http.";
 
     /**
      * Returns protocol version used in this context.
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SocksProxyProtocolHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SocksProxyProtocolHandler.java
index 73fd246..9d3e72e 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SocksProxyProtocolHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SocksProxyProtocolHandler.java
@@ -70,7 +70,7 @@ final class SocksProxyProtocolHandler implements IOEventHandler {
 
     private static final byte ATYP_IPV6 = 4;
 
-    private static enum State {
+    private enum State {
         SEND_AUTH, RECEIVE_AUTH_METHOD, SEND_USERNAME_PASSWORD, RECEIVE_AUTH, SEND_CONNECT, RECEIVE_RESPONSE_CODE, RECEIVE_ADDRESS_TYPE, RECEIVE_ADDRESS, COMPLETE
     }
 


[httpcomponents-core] 08/09: Remote extra semicolons (;).

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

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

commit b6cf5a667c716ad4667870cb50c9e64607672e4d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 12:35:03 2020 -0500

    Remote extra semicolons (;).
---
 .../src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
index a2359aa..c77d0c6 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
@@ -344,7 +344,7 @@ class SingleCoreIOReactor extends AbstractSingleCoreIOReactor implements Connect
                             @Override
                             public Boolean run() throws IOException {
                                 return socketChannel.connect(targetAddress);
-                            };
+                            }
                         });
         } catch (final PrivilegedActionException e) {
             Asserts.check(e.getCause() instanceof  IOException,


[httpcomponents-core] 04/09: Add missing @Override.

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

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

commit b1ab7937361f273e78358289b5c3f2e95d6f96c3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 11:13:31 2020 -0500

    Add missing @Override.
---
 httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java | 2 ++
 1 file changed, 2 insertions(+)

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 2985704..fd3813f 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
@@ -189,6 +189,7 @@ public interface IOSession extends ByteChannel, SocketModalCloseable, Identifiab
      *
      * @return socket timeout.
      */
+    @Override
     Timeout getSocketTimeout();
 
     /**
@@ -201,6 +202,7 @@ public interface IOSession extends ByteChannel, SocketModalCloseable, Identifiab
      *
      * @param timeout socket timeout.
      */
+    @Override
     void setSocketTimeout(Timeout timeout);
 
     /**


[httpcomponents-core] 07/09: Use Collections.addAll() API instead of loops.

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

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

commit 1699ac4e5fa79efbb4b64494fea5626a2381d4b5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 12:06:09 2020 -0500

    Use Collections.addAll() API instead of loops.
---
 httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java  | 4 +---
 .../src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java | 9 +++------
 .../org/apache/hc/core5/http/message/TestMessageSupport.java     | 5 ++---
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java b/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
index 9863d6e..512c0b7 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
@@ -442,9 +442,7 @@ public class URIBuilder {
         } else {
             this.queryParams.clear();
         }
-        for (final NameValuePair nvp: nvps) {
-            this.queryParams.add(nvp);
-        }
+        Collections.addAll(this.queryParams, nvps);
         this.encodedQuery = null;
         this.encodedSchemeSpecificPart = null;
         this.query = null;
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java b/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
index 89ecac2..1a2b69d 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
@@ -46,6 +46,7 @@ import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
@@ -210,9 +211,7 @@ public class SSLContextBuilder {
                     }
                 }
             }
-            for (final TrustManager tm : tms) {
-                this.trustManagers.add(tm);
-            }
+            Collections.addAll(this.trustManagers, tms);
         }
         return this;
     }
@@ -282,9 +281,7 @@ public class SSLContextBuilder {
                     }
                 }
             }
-            for (final KeyManager km : kms) {
-                keyManagers.add(km);
-            }
+            Collections.addAll(keyManagers, kms);
         }
         return this;
     }
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestMessageSupport.java b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestMessageSupport.java
index cf80a4d..5426c70 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestMessageSupport.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestMessageSupport.java
@@ -28,6 +28,7 @@
 package org.apache.hc.core5.http.message;
 
 import java.nio.charset.StandardCharsets;
+import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
@@ -47,9 +48,7 @@ public class TestMessageSupport {
             return null;
         }
         final Set<String> set = new LinkedHashSet<>();
-        for (final String token: tokens) {
-            set.add(token);
-        }
+        Collections.addAll(set, tokens);
         return set;
     }
 


[httpcomponents-core] 05/09: Make better use of Map APIs.

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

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

commit 02acf9c0e45e2ad0762d170ae215ac6236447417
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 11:36:22 2020 -0500

    Make better use of Map APIs.
---
 .../src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java b/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
index 5ce874d..bc36248 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
@@ -545,7 +545,7 @@ public class TestSSLContextBuilder {
             @Override
             public String chooseAlias(final Map<String, PrivateKeyDetails> aliases,
                             final SSLParameters sslParameters) {
-                return aliases.keySet().contains("client2") ? "client2" : null;
+                return aliases.containsKey("client2") ? "client2" : null;
             }
         };
 


[httpcomponents-core] 03/09: Use diamonds.

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

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

commit 8db1013fa1603b3ec75ecb5a4a8c35d8f0ddb342
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 10:49:09 2020 -0500

    Use diamonds.
---
 .../test/java/org/apache/hc/core5/http2/examples/H2GreetingServer.java  | 2 +-
 .../src/main/java/org/apache/hc/core5/testing/SocksProxy.java           | 2 +-
 httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/H2GreetingServer.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/H2GreetingServer.java
index 2f5df7a..6e94a2d 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/H2GreetingServer.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/H2GreetingServer.java
@@ -136,7 +136,7 @@ public class H2GreetingServer {
                 entityConsumer = new StringAsyncEntityConsumer();
             }
             //noinspection unchecked
-            return new BasicRequestConsumer<String>(entityConsumer);
+            return new BasicRequestConsumer<>(entityConsumer);
 
         }
 
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/SocksProxy.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/SocksProxy.java
index 2ddce4f..40a17a3 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/SocksProxy.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/SocksProxy.java
@@ -210,7 +210,7 @@ public class SocksProxy {
 
     private final int port;
 
-    private final List<SocksProxyHandler> handlers = new ArrayList<SocksProxyHandler>();
+    private final List<SocksProxyHandler> handlers = new ArrayList<>();
     private ServerSocket server;
     private Thread serverThread;
 
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
index 82d2119..26b56e6 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
@@ -419,7 +419,7 @@ public class LaxConnPool<T, C extends ModalCloseable> implements ManagedConnPool
                 prev = allocated.get();
                 next = (prev<poolmax)? prev+1 : prev;
             } while (!allocated.compareAndSet(prev, next));
-            return (prev < next)? new PoolEntry<T,C>(route, timeToLive, disposalCallback) : null;
+            return (prev < next)? new PoolEntry<>(route, timeToLive, disposalCallback) : null;
         }
 
         private void deallocatePoolEntry() {