[ 
https://issues.apache.org/jira/browse/CXF-5836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Kulp resolved CXF-5836.
------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0.1
                   2.7.12
         Assignee: Daniel Kulp

> NullPointerException in AsyncHTTPConduit if http.noProxyHosts set
> -----------------------------------------------------------------
>
>                 Key: CXF-5836
>                 URL: https://issues.apache.org/jira/browse/CXF-5836
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.7.6, 2.7.7, 2.7.8, 2.7.9, 2.7.10, 2.7.11
>         Environment: Windows or Linux
>            Reporter: Nicolas Sprauel
>            Assignee: Daniel Kulp
>            Priority: Critical
>              Labels: easyfix
>             Fix For: 2.7.12, 3.0.1
>
>
> This issue occurs when using the asynchronous conduit (use.async.http.conduit 
> set to true), AND with the environment proxy configuration set 
> (http.proxyHost, http.proxyPort, and http.nonProxyHosts properties set).
> The end of the AsyncHTTPConduit.setupConnection() method calls:
> <code>
>         Proxy p = proxyFactory.createProxy(csPolicy , uri);
>         if (p != null) {
> </code>
> When the http.nonProxyHosts property matches the target server host, then the 
> ProxyFactory.createProxy() method returns Proxy.NO_PROXY, and not null. This 
> means that because p is not null, the next 2 lines are executed:
> <code>
>             InetSocketAddress isa = (InetSocketAddress)p.address();
>             HttpHost proxy = new HttpHost(isa.getHostName(), isa.getPort());
> </code>
> p.address() returns null as expected, which means that the next line (line 
> 200 in release 2.7.6) causes a NullPointerException, and crashes the call.
> The fix would be simple, by replacing:
> <code>
>         if (p != null) {
> </code>
> with
> <code>
>         if (p != null && !p.type() == Proxy.Type.DIRECT) {
> </code>



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to