hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Krugler <kkrugler_li...@transpac.com>
Subject Re: Invalid URL causes no Exception - instance keeps still
Date Thu, 09 Sep 2010 16:05:35 GMT
> I noticed that when I do something like:
> 			System.out.println("execute Request "+method.getURI());
> 			int statuscode = this.httpClient.executeMethod(method);
> 			System.out.println("statuscode: "+statuscode);
> The line "statuscode" is never printed, if the method was created  
> with an
> invalid URL.
> In my test case, I tried something like that:
> PostMethod method = new PostMethod("path");
> Yes, I really mean "path" - this is my invalid url.
> How should I notice that there went something wrong, when no  
> Exception is
> thrown?

No idea why you're seeing this behavior - in my experience, HttpClient  
either throws an exception or returns a valid status code.

Though I've never had this happen with HttpClient, some 3rd party jars  
can trigger Errors instead of Exceptions, so make sure you've got a  
catch(Throwable t) in place.

-- Ken

Ken Krugler
+1 530-210-6378
e l a s t i c   w e b   m i n i n g

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

View raw message