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 2020/11/23 23:37:19 UTC

[httpcomponents-core] 05/06: No need to explicitly declare an array when calling a vararg method.

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

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

commit a446e39cefb13c83081cb45956ebc84e76496ccc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 12:26:17 2020 -0500

    No need to explicitly declare an array when calling a vararg method.
---
 .../java/org/apache/http/benchmark/HttpServer.java | 11 +++----
 .../nio/reactor/TestDefaultListeningIOReactor.java |  6 ++--
 .../org/apache/http/integration/TestSyncHttp.java  | 34 +++++++++-------------
 3 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/httpcore-ab/src/test/java/org/apache/http/benchmark/HttpServer.java b/httpcore-ab/src/test/java/org/apache/http/benchmark/HttpServer.java
index 6018c77..1639d46 100644
--- a/httpcore-ab/src/test/java/org/apache/http/benchmark/HttpServer.java
+++ b/httpcore-ab/src/test/java/org/apache/http/benchmark/HttpServer.java
@@ -35,7 +35,6 @@ import java.net.Socket;
 
 import org.apache.http.ConnectionClosedException;
 import org.apache.http.HttpException;
-import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.HttpServerConnection;
 import org.apache.http.impl.DefaultBHttpServerConnection;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
@@ -65,12 +64,10 @@ public class HttpServer {
     public HttpServer() throws IOException {
         super();
         this.httpproc = new ImmutableHttpProcessor(
-                new HttpResponseInterceptor[] {
-                        new ResponseDate(),
-                        new ResponseServer("TEST-SERVER/1.1"),
-                        new ResponseContent(),
-                        new ResponseConnControl()
-                });
+                new ResponseDate(),
+                new ResponseServer("TEST-SERVER/1.1"),
+                new ResponseContent(),
+                new ResponseConnControl());
         this.reqistry = new UriHttpRequestHandlerMapper();
         this.serversocket = new ServerSocket(0);
     }
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
index 784b423..2f03da2 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
@@ -34,7 +34,6 @@ import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.DefaultHttpServerIODispatch;
 import org.apache.http.nio.protocol.HttpAsyncService;
@@ -59,12 +58,11 @@ import org.junit.Test;
 public class TestDefaultListeningIOReactor {
 
     private static IOEventDispatch createIOEventDispatch() {
-        final HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
+        final HttpProcessor httpproc = new ImmutableHttpProcessor(
                 new ResponseDate(),
                 new ResponseServer(),
                 new ResponseContent(),
-                new ResponseConnControl()
-        });
+                new ResponseConnControl());
         final HttpAsyncService serviceHandler = new HttpAsyncService(httpproc,
                 new UriHttpAsyncRequestHandlerMapper());
         return new DefaultHttpServerIODispatch(serviceHandler, ConnectionConfig.DEFAULT);
diff --git a/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java b/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java
index 2a6aa5b..006a8d0 100644
--- a/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java
+++ b/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java
@@ -845,11 +845,10 @@ public class TestSyncHttp {
             post.setEntity(null);
 
             this.client = new HttpClient(new ImmutableHttpProcessor(
-                    new HttpRequestInterceptor[] {
-                            new RequestTargetHost(),
-                            new RequestConnControl(),
-                            new RequestUserAgent(),
-                            new RequestExpectContinue(true) }));
+                    new RequestTargetHost(),
+                    new RequestConnControl(),
+                    new RequestUserAgent(),
+                    new RequestExpectContinue(true)));
 
             final HttpResponse response = this.client.execute(post, host, conn);
             Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
@@ -898,21 +897,16 @@ public class TestSyncHttp {
             post.setEntity(null);
 
             this.client = new HttpClient(new ImmutableHttpProcessor(
-                    new HttpRequestInterceptor[] {
-                            new HttpRequestInterceptor() {
-
-                                @Override
-                                public void process(
-                                        final HttpRequest request,
-                                        final HttpContext context) throws HttpException, IOException {
-                                    request.addHeader(HTTP.TRANSFER_ENCODING, "identity");
-                                }
-
-                            },
-                            new RequestTargetHost(),
-                            new RequestConnControl(),
-                            new RequestUserAgent(),
-                            new RequestExpectContinue(true) }));
+                    new HttpRequestInterceptor() {
+
+                        @Override
+                        public void process(
+                                final HttpRequest request,
+                                final HttpContext context) throws HttpException, IOException {
+                            request.addHeader(HTTP.TRANSFER_ENCODING, "identity");
+                        }
+
+                    }, new RequestTargetHost(), new RequestConnControl(), new RequestUserAgent(), new RequestExpectContinue(true)));
 
             final HttpResponse response = this.client.execute(post, host, conn);
             Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, response.getStatusLine().getStatusCode());