Hi Brad, Exception handling is one of those current design deficiencies I was referring to. Unfortunately things got quite messy in 2.0. Depending upon circumstances HttpException may be thrown to represent a transport error or a protocol error. Frankly there's no easy / reliable way of defining the rules of when HttpException can be thrown. CVS HEAD (3.0 pre-alpha-1) already contains completely reworked exception framework where HttpException represents a protocol error (malformed request, etc) and nothing else.
The only good news I have for you is that HttpException is never used to report any normal server response including 5xx status codes. That is, if a HTTP response is received in its entirety and is syntactically correct, HttpException is never thrown. Javadocs are simply in need of cleanup Oleg -----Original Message----- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 18:00 To: HttpClient Subject: When does an HttpException occur in httpclient.execute()? Hey gang, Just came across something rather odd. I have an instance of HttpClient and am invoking the execute() method passing it a PostMethod. I have two comments/questions: 1. It looks subtle, but I think the method needs to be rewritten to list its HttpException prior to the IOException, so the compiler will force handling of HttpException prior to forcing IOException. This may be esoteric, but if you handle the IOException first, the HttpException may go unnoticed, as it is a subclass of IOException. 2. When is an HttpException thrown? Looking at the Javadoc, the execute method returns a response status, yet the HttpException holds the same types of response statuses. When does the execute method return with a response status, versus when an HttpException is thrown to return the response status? I pulled my network cable out of my hub while the execute() method was executing, and received an IOException, not an HttpException. I also returned various HTTP failure response statuses like 500 back to client from my server, and wasn't getting an HttpException, but the execute method was completing properly, and the status code was returned there. When does an HttpException occur? Thanks for your help in advance, BradO --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]