You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ro...@apache.org on 2007/12/22 15:46:10 UTC

svn commit: r606454 - in /httpcomponents/oac.hc3x/trunk: release_notes.txt src/java/org/apache/commons/httpclient/SimpleHttpConnectionManager.java

Author: rolandw
Date: Sat Dec 22 06:46:07 2007
New Revision: 606454

URL: http://svn.apache.org/viewvc?rev=606454&view=rev
Log:
HTTPCLIENT-717: added null check to shutdown and closeIdleConnections

Modified:
    httpcomponents/oac.hc3x/trunk/release_notes.txt
    httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/SimpleHttpConnectionManager.java

Modified: httpcomponents/oac.hc3x/trunk/release_notes.txt
URL: http://svn.apache.org/viewvc/httpcomponents/oac.hc3x/trunk/release_notes.txt?rev=606454&r1=606453&r2=606454&view=diff
==============================================================================
--- httpcomponents/oac.hc3x/trunk/release_notes.txt (original)
+++ httpcomponents/oac.hc3x/trunk/release_notes.txt Sat Dec 22 06:46:07 2007
@@ -1,3 +1,10 @@
+Changes since 3.1 Final
+
+* [HTTPCLIENT-717] - Fixed NPE in unused SimpleHttpConnectionManager.
+           Contributed by Roland Weber <rolandw at apache.org>
+
+
+
 Release 3.1 Final
 -------------------
 

Modified: httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/SimpleHttpConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/SimpleHttpConnectionManager.java?rev=606454&r1=606453&r2=606454&view=diff
==============================================================================
--- httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/SimpleHttpConnectionManager.java (original)
+++ httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/SimpleHttpConnectionManager.java Sat Dec 22 06:46:07 2007
@@ -268,6 +268,8 @@
      * @since 3.0
      */
     public void closeIdleConnections(long idleTimeout) {
+        if (httpConnection == null)
+            return;
         long maxIdleTime = System.currentTimeMillis() - idleTimeout;
         if (idleStartTime <= maxIdleTime) {
             httpConnection.close();
@@ -278,7 +280,8 @@
      * since 3.1
      */
     public void shutdown() {
-        httpConnection.close();
+        if (httpConnection != null)
+            httpConnection.close();
     }
     
 }