From b6ae693fe5a86ba9a8390bd209a71a32a1922226 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 11 Oct 2021 11:41:23 -0400 Subject: [PATCH] Don't initialize AtomicReference to its default value. --- .../client5/http/impl/cache/DefaultAsyncCacheRevalidator.java | 2 +- .../org/apache/hc/client5/testing/async/AsyncEchoHandler.java | 2 +- .../org/apache/hc/client5/testing/async/AsyncRandomHandler.java | 2 +- .../hc/client5/testing/async/AuthenticatingAsyncDecorator.java | 2 +- .../testing/async/AbstractHttpReactiveFundamentalsTest.java | 2 +- .../hc/client5/http/impl/async/H2AsyncMainClientExec.java | 2 +- .../hc/client5/http/impl/async/HttpAsyncMainClientExec.java | 2 +- .../hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java | 2 +- .../client5/http/impl/async/InternalHttpAsyncExecRuntime.java | 2 +- .../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 43fab111a..ed2a1b98d 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 @@ -120,7 +120,7 @@ class DefaultAsyncCacheRevalidator extends CacheRevalidatorBase { final RevalidationCall call) { scheduleRevalidation(cacheKey, () -> call.execute(new AsyncExecCallback() { - private final AtomicReference responseRef = new AtomicReference<>(null); + private final AtomicReference 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 b1c58b9f6..4491bbd25 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 fa0e1486a..4a3220c22 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 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 b3bfdc71a..cad07b812 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 77ddbb782..20bf67bd8 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 @@ -299,7 +299,7 @@ public abstract class AbstractHttpReactiveFundamentalsTest expectedHash = new AtomicReference<>(null); + final AtomicReference expectedHash = new AtomicReference<>(); final Flowable 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 2a006b785..4e49bb52d 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 entityConsumerRef = new AtomicReference<>(null); + private final AtomicReference 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 c8e4e2649..87bba2a58 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 entityConsumerRef = new AtomicReference<>(null); + private final AtomicReference 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 3bd2007df..6bad8d4e6 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 @@ -68,7 +68,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 bbc34fae6..390340340 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 @@ -75,7 +75,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 983318d7c..9e7a8ebb6 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; }