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 2021/10/13 19:57:26 UTC

[httpcomponents-client] branch 5.1.x updated: Don't initialize AtomicReference to its default value.

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

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


The following commit(s) were added to refs/heads/5.1.x by this push:
     new 7c4e865  Don't initialize AtomicReference to its default value.
7c4e865 is described below

commit 7c4e865a8ce368951b6146b6868b418182eeb5dc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Oct 13 15:57:23 2021 -0400

    Don't initialize AtomicReference to its default value.
---
 .../apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java | 2 +-
 .../main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java | 2 +-
 .../java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java    | 2 +-
 .../apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java   | 2 +-
 .../hc/client5/testing/async/AbstractHttpReactiveFundamentalsTest.java  | 2 +-
 .../org/apache/hc/client5/http/impl/async/H2AsyncMainClientExec.java    | 2 +-
 .../org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java  | 2 +-
 .../apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java   | 2 +-
 .../apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java | 2 +-
 .../org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java    | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
index 90718d8..6a66194 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
@@ -124,7 +124,7 @@ class DefaultAsyncCacheRevalidator extends CacheRevalidatorBase {
                         public void run() {
                             call.execute(new AsyncExecCallback() {
 
-                                private final AtomicReference<HttpResponse> responseRef = new AtomicReference<>(null);
+                                private final AtomicReference<HttpResponse> responseRef = new AtomicReference<>();
 
                                 @Override
                                 public AsyncDataConsumer handleResponse(
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
index b1c58b9..4491bbd 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
@@ -61,7 +61,7 @@ public class AsyncEchoHandler implements AsyncServerExchangeHandler {
 
     public AsyncEchoHandler() {
         this.entityConsumer = new BasicAsyncEntityConsumer();
-        this.entityProducerRef = new AtomicReference<>(null);
+        this.entityProducerRef = new AtomicReference<>();
     }
 
     @Override
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
index fa0e148..4a3220c 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
@@ -63,7 +63,7 @@ public class AsyncRandomHandler implements AsyncServerExchangeHandler {
     private final AtomicReference<AsyncEntityProducer> entityProducerRef;
 
     public AsyncRandomHandler() {
-        this.entityProducerRef = new AtomicReference<>(null);
+        this.entityProducerRef = new AtomicReference<>();
     }
 
     @Override
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
index b3bfdc7..cad07b8 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
@@ -65,7 +65,7 @@ public class AuthenticatingAsyncDecorator implements AsyncServerExchangeHandler
     public AuthenticatingAsyncDecorator(final AsyncServerExchangeHandler exchangeHandler, final Authenticator authenticator) {
         this.exchangeHandler = Args.notNull(exchangeHandler, "Request handler");
         this.authenticator = Args.notNull(authenticator, "Authenticator");
-        this.responseProducerRef = new AtomicReference<>(null);
+        this.responseProducerRef = new AtomicReference<>();
         this.authTokenExtractor = new BasicAuthTokenExtractor();
     }
 
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpReactiveFundamentalsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpReactiveFundamentalsTest.java
index e4814f1..aed1aba 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpReactiveFundamentalsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpReactiveFundamentalsTest.java
@@ -307,7 +307,7 @@ public abstract class AbstractHttpReactiveFundamentalsTest<T extends CloseableHt
             while (testCases.size() < numTestCases) {
                 final long seed = 198723L * testCaseNum++;
                 final int length = 1 + new Random(seed).nextInt(maxSize);
-                final AtomicReference<String> expectedHash = new AtomicReference<>(null);
+                final AtomicReference<String> expectedHash = new AtomicReference<>();
                 final Flowable<ByteBuffer> stream = ReactiveTestUtils.produceStream(length, expectedHash);
                 final StreamingTestCase streamingTestCase = new StreamingTestCase(length, expectedHash, stream);
                 testCases.put((long) length, streamingTestCase);
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncMainClientExec.java
index 2a006b7..4e49bb5 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncMainClientExec.java
@@ -88,7 +88,7 @@ public class H2AsyncMainClientExec implements AsyncExecChainHandler {
 
         final AsyncClientExchangeHandler internalExchangeHandler = new AsyncClientExchangeHandler() {
 
-            private final AtomicReference<AsyncDataConsumer> entityConsumerRef = new AtomicReference<>(null);
+            private final AtomicReference<AsyncDataConsumer> entityConsumerRef = new AtomicReference<>();
 
             @Override
             public void releaseResources() {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
index 7816f44..23eb2b9 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
@@ -104,7 +104,7 @@ class HttpAsyncMainClientExec implements AsyncExecChainHandler {
         final AtomicInteger messageCountDown = new AtomicInteger(2);
         final AsyncClientExchangeHandler internalExchangeHandler = new AsyncClientExchangeHandler() {
 
-            private final AtomicReference<AsyncDataConsumer> entityConsumerRef = new AtomicReference<>(null);
+            private final AtomicReference<AsyncDataConsumer> entityConsumerRef = new AtomicReference<>();
 
             @Override
             public void releaseResources() {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java
index 957eeac..62ddaaa 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java
@@ -69,7 +69,7 @@ class InternalH2AsyncExecRuntime implements AsyncExecRuntime {
         this.log = log;
         this.connPool = connPool;
         this.pushHandlerFactory = pushHandlerFactory;
-        this.sessionRef = new AtomicReference<>(null);
+        this.sessionRef = new AtomicReference<>();
     }
 
     @Override
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java
index 7d47c47..8cc6e08 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java
@@ -74,7 +74,7 @@ class InternalHttpAsyncExecRuntime implements AsyncExecRuntime {
         this.connectionInitiator = connectionInitiator;
         this.pushHandlerFactory = pushHandlerFactory;
         this.versionPolicy = versionPolicy;
-        this.endpointRef = new AtomicReference<>(null);
+        this.endpointRef = new AtomicReference<>();
         this.validDuration = TimeValue.NEG_ONE_MILLISECOND;
     }
 
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
index 790f076..4a9220c 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
@@ -76,7 +76,7 @@ class InternalExecRuntime implements ExecRuntime, Cancellable {
         this.manager = manager;
         this.requestExecutor = requestExecutor;
         this.cancellableDependency = cancellableDependency;
-        this.endpointRef = new AtomicReference<>(null);
+        this.endpointRef = new AtomicReference<>();
         this.validDuration = TimeValue.NEG_ONE_MILLISECOND;
     }