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/03/06 22:06:22 UTC

[httpcomponents-client] branch development updated: Fix NPE for null HttpContext in MinimalHttpAsyncClient

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

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


The following commit(s) were added to refs/heads/development by this push:
     new ac53070  Fix NPE for null HttpContext in MinimalHttpAsyncClient
ac53070 is described below

commit ac53070d1dbc3e5ddc113af7b4d284486ba6511c
Author: slisaasquatch <sl...@saasquat.ch>
AuthorDate: Fri Mar 6 11:31:42 2020 -0800

    Fix NPE for null HttpContext in MinimalHttpAsyncClient
---
 .../org/apache/hc/client5/http/impl/async/MinimalH2AsyncClient.java     | 2 +-
 .../org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalH2AsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalH2AsyncClient.java
index bd4a35d..dc23b62 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalH2AsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalH2AsyncClient.java
@@ -136,7 +136,7 @@ public final class MinimalH2AsyncClient extends AbstractMinimalHttpAsyncClientBa
             final HttpContext context) {
         ensureRunning();
         final ComplexCancellable cancellable = new ComplexCancellable();
-        final HttpClientContext clientContext = HttpClientContext.adapt(context);
+        final HttpClientContext clientContext = context != null ? HttpClientContext.adapt(context) : HttpClientContext.create();
         try {
             exchangeHandler.produceRequest(new RequestChannel() {
 
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
index 65af820..d4e95d2 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
@@ -248,7 +248,7 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
             final HttpContext context) {
         ensureRunning();
         final ComplexCancellable cancellable = new ComplexCancellable();
-        final HttpClientContext clientContext = HttpClientContext.adapt(context);
+        final HttpClientContext clientContext = context != null ? HttpClientContext.adapt(context) : HttpClientContext.create();
         try {
             exchangeHandler.produceRequest(new RequestChannel() {