Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 03A71E481 for ; Thu, 10 Jan 2013 11:30:14 +0000 (UTC) Received: (qmail 65009 invoked by uid 500); 10 Jan 2013 11:30:13 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 64583 invoked by uid 500); 10 Jan 2013 11:30:13 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 64453 invoked by uid 99); 10 Jan 2013 11:30:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jan 2013 11:30:12 +0000 Date: Thu, 10 Jan 2013 11:30:12 +0000 (UTC) From: "Karl Wright (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (HTTPCLIENT-1296) Null pointer exception when using default host and virtual host with port -1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Karl Wright resolved HTTPCLIENT-1296. ------------------------------------- Resolution: Fixed Fix Version/s: 4.2.3 > 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 > Assignee: Karl Wright > Priority: Critical > Fix For: 4.2.3 > > Attachments: HTTPCLIENT-1296.patch > > > 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