Return-Path: Delivered-To: apmail-jakarta-commons-httpclient-dev-archive@www.apache.org Received: (qmail 94466 invoked from network); 2 Feb 2004 17:20:54 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 2 Feb 2004 17:20:54 -0000 Received: (qmail 66211 invoked by uid 500); 2 Feb 2004 17:20:43 -0000 Delivered-To: apmail-jakarta-commons-httpclient-dev-archive@jakarta.apache.org Received: (qmail 66183 invoked by uid 500); 2 Feb 2004 17:20:43 -0000 Mailing-List: contact commons-httpclient-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Commons HttpClient Project" Reply-To: "Commons HttpClient Project" Delivered-To: mailing list commons-httpclient-dev@jakarta.apache.org Received: (qmail 66157 invoked from network); 2 Feb 2004 17:20:42 -0000 Received: from unknown (HELO kccxoex16.corp.kpmgconsulting.com) (57.80.136.22) by daedalus.apache.org with SMTP; 2 Feb 2004 17:20:42 -0000 Received: from kccxoex06.corp.kpmgconsulting.com ([10.98.3.31]) by kccxoex16 with trend_isnt_name_B; Mon, 02 Feb 2004 17:20:47 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: When does an HttpException occur in httpclient.execute()? Date: Mon, 2 Feb 2004 17:20:19 -0000 Message-ID: <825BF35A92B3F0479CC164ECBBE9376E0DE6BE@kccxoex06.corp.kpmgconsulting.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: When does an HttpException occur in httpclient.execute()? Thread-Index: AcPprYfggqgGfX1TTEeiZlbyEA4sTgAAP/fg From: "Kalnichevski, Oleg" To: "Commons HttpClient Project" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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.=20 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:brado@neurofire.com] 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: = commons-httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: = commons-httpclient-dev-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org