hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (Resolved) (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HTTPCLIENT-1166) URIUtils.extractHost(...) throws a NumberFormatException line 310
Date Tue, 14 Feb 2012 16:20:01 GMT

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

Oleg Kalnichevski resolved HTTPCLIENT-1166.
-------------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2 Beta2

Fair enough. A runtime exception thrown in this case is clearly wrong. At the same I am not
very comfortable throwing MalformedURIException either as the URI was (partially) parsed and
accepted by java.net.URI. I just tweaked the fall-back parsing logic in the #extractHost method
and made sure NumberFormatException would not get thrown.

Oleg  
                
> URIUtils.extractHost(...) throws a NumberFormatException line 310
> -----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1166
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1166
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.1.2
>         Environment: Linux,
>            Reporter: martial sauvette
>            Priority: Minor
>             Fix For: 4.2 Beta2
>
>
> Original Jboss-seam-wicket-booking application in Jboss-4.2.3.GA started, post a login
request thanks httpclient, then NumberFormatException.
> regarding this page :
> http://hc.apache.org/httpcomponents-client-dev/httpclient/clover/org/apache/http/client/utils/URIUtils.html
> 305 	   	// Extract the port suffix, if present
> 306 	   	if (host != null) {
> 307 	  	   int colon = host.indexOf(':');
> 308 	   	   if (colon >= 0) {
> 309 	   	      if (colon+1 < host.length()) {
> 310 	   	          port = Integer.parseInt(host.substring(colon+1));
> 311 	   	      }
> 312 	  	   host = host.substring(0,colon);
> 313 	   	   }
> 314 	   	}
> resolving the port throw a NumberFormatException
> java.lang.NumberFormatException: For input string: "8080;jsessionid=9E9EDA0B6E1CDD499A0A15C4A8F212D8"
> 	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> 	at java.lang.Integer.parseInt(Integer.java:458)
> 	at java.lang.Integer.parseInt(Integer.java:499)
> 	at org.apache.http.client.utils.URIUtils.extractHost(URIUtils.java:310)
> 	at org.apache.http.impl.client.AbstractHttpClient.determineTarget(AbstractHttpClient.java:764)
> 	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
> 	at org.tagbrowser.api.TagBrowser.request(TagBrowser.java:109)
> another case of this problem canbe found hier :
> https://gitorious.org/yacy/rc1/commit/8b0920b0b5eb67ae17eec24c1bf3a059543cb6e8/diffs

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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