[ https://issues.apache.org/jira/browse/HTTPCLIENT-2367?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jason Mathison updated HTTPCLIENT-2367: --------------------------------------- Description: Starting in the 5.4.3 release of HttpClient, in the org/apache/hc/client5/http/impl/async/InternalAbstractHttpAsyncClient.java file, it is possible to get an Null Pointer Exception thrown by this section of code: final HttpHost resolvedTarget = target != null ? target : RoutingSupport.determineHost(request); if (request.getScheme() == null) { request.setScheme(resolvedTarget.getSchemeName()); } The issue is that the RoutingSupport.determineHost can return null, then this line request.setScheme(resolvedTarget.getSchemeName()); will attempt to dereference resolvedTarget, which is null. An example that can cause this is a BasicHttpRequest with a path and requestUri of /foo/bar and a null scheme. Note the lack of a host name in the path/requestUri. was: Starting in the 5.4.3 release of HttpClient, in the org/apache/hc/client5/http/impl/async/InternalAbstractHttpAsyncClient.java file, it is possible to get an Null Pointer Exception thrown by this section of code: final HttpHost resolvedTarget = target != null ? target : RoutingSupport.determineHost(request); if (request.getScheme() == null) { request.setScheme(resolvedTarget.getSchemeName()); } The issue is that the RoutingSupport.determineHost can return null, then this line request.setScheme(resolvedTarget.getSchemeName()); will attempt to dereference resolvedTarget, which is null. > InternalAbstractHttpAsyncClient.java NPE when determineHost returns null > ------------------------------------------------------------------------ > > Key: HTTPCLIENT-2367 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2367 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient (async) > Affects Versions: 5.4.3, 5.4.4 > Reporter: Jason Mathison > Priority: Major > > Starting in the 5.4.3 release of HttpClient, in the > org/apache/hc/client5/http/impl/async/InternalAbstractHttpAsyncClient.java > file, it is possible to get an Null Pointer Exception thrown by this section > of code: > > final HttpHost resolvedTarget = target != null ? target : > RoutingSupport.determineHost(request); > if (request.getScheme() == null) > { request.setScheme(resolvedTarget.getSchemeName()); } > > The issue is that the RoutingSupport.determineHost can return null, then this > line > request.setScheme(resolvedTarget.getSchemeName()); > will attempt to dereference resolvedTarget, which is null. > An example that can cause this is a BasicHttpRequest with a path and > requestUri of /foo/bar and a null scheme. Note the lack of a host name in the > path/requestUri. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org