hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Created: (HTTPCLIENT-717) NPE in SimpleHttpConnectionManager.shutdown()
Date Thu, 13 Dec 2007 15:20:43 GMT
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


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: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message