hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roland Weber (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HTTPCLIENT-717) NPE in SimpleHttpConnectionManager.shutdown()
Date Sat, 22 Dec 2007 14:48:43 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Roland Weber resolved HTTPCLIENT-717.

    Resolution: Fixed

I've added null checks to both methods.
If anybody wants to contribute unit tests, you're welcome.


> NPE in SimpleHttpConnectionManager.shutdown()
> ---------------------------------------------
>                 Key: HTTPCLIENT-717
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-717
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>    Affects Versions: 3.1 Final
>            Reporter: Sebb
>             Fix For: 3.1.1
> SimpleHttpConnectionManager.shutdown() causes NPE if no connection has been created,
whereas MultiThreadedHttpConnectionManager.shutdown() does not.
> Simple test case:
> 	MultiThreadedHttpConnectionManager cm = new MultiThreadedHttpConnectionManager();
> 	cm.shutdown(); // OK
> 	SimpleHttpConnectionManager sm = new SimpleHttpConnectionManager();
> 	sm.shutdown(); // NPE
> I came across this in JMeter - a sample was using Post with AutoRedirect, which (correctly)
caused an IllegalArgumentException, and so the connection was not created. 
> The JMeter code could try to keep track of this, but it would be tedious, and it seems
to me that SimpleHttpConnectionManager should ignore the shutdown() if the connection is null.
> The problem does not arise when using closeIdleConnections(timeout) - unless one uses
the special value:
>       closeIdleConnections(System.currentTimeMillis() - Long.MAX_VALUE)
> but it would probably be sensible to protect against this as well.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

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

View raw message