hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Wright (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1296) Null pointer exception when using default host and virtual host with port -1
Date Thu, 10 Jan 2013 00:54:12 GMT
Karl Wright created HTTPCLIENT-1296:
---------------------------------------

             Summary: Null pointer exception when using default host and virtual host with
port -1
                 Key: HTTPCLIENT-1296
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1296
             Project: HttpComponents HttpClient
          Issue Type: Bug
    Affects Versions: 4.2.2
            Reporter: Karl Wright
            Priority: Critical


The following code in DefaultRequestDirector is incorrect:

{code}
        // HTTPCLIENT-1092 - add the port if necessary
        if (virtualHost != null && virtualHost.getPort() == -1) {
            int port = target.getPort();
            if (port != -1){
                virtualHost = new HttpHost(virtualHost.getHostName(), port, virtualHost.getSchemeName());
            }
        }
{code}

The reason it is incorrect is that if the target has not been specified in the URL, then an
NPE will result.  The target is resolved later in the same method in that case.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message