hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 21754] - NullPointerException when releasing connection
Date Mon, 21 Jul 2003 06:09:56 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21754>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21754

NullPointerException when releasing connection

adrian@ephox.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



------- Additional Comments From adrian@ephox.com  2003-07-21 06:09 -------
Roland is spot on.  You shouldn't be managing your connections manually as it's not the way

HttpClient was designed to work and you miss out on all it's safety checks (like avoiding
that NPE).  
If you need to have fine grained control over connections, you can create a class that implements

HttpConnectionManager and pass that into the HttpClient constructor.

If you haven't already, you should take a look at http://jakarta.apache.org/commons/httpclient/
tutorial.html to get an idea of how HttpClient was designed to be used.

In this particular case, HttpConnection.releaseConnection() is being called twice which shouldn't

ever happen (once by your code, once when all the data is read).  You should instead be using

HttpClient.executeMethod() and then at the end calling HttpMethod.releaseConnection() which
can 
be called any number of times safely.

I'm marking this bug as invalid as it doesn't require any more changes, I'm still quite happy
to 
provide more help/assistance/answer questions etc if required though.  Probably best to post

directly to the HttpClient-dev list to make replying easier.

Mime
View raw message