hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad O'Hearne" <br...@neurofire.com>
Subject When does an HttpException occur in httpclient.execute()?
Date Mon, 02 Feb 2004 17:00:10 GMT
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


Mime
View raw message