The fix is simple. But I failed to figure out is how on earth
responseBodyConsumed() got called with null responseConnection.

Tim, can you explain under what kind of circumstances NPE in
responseBodyConsumed occurs? A test case would be fantastic.

Cheers

Oleg

On Wed, 2003-10-15 at 23:28, Tim McCune wrote:
> This patch
> also contains a fix in HttpMethodBase.java for a NullPointerException
> that happens when responseConnection is null

Index: java/org/apache/commons/httpclient/HttpMethodBase.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
retrieving revision 1.159.2.14
diff -u -r1.159.2.14 HttpMethodBase.java
--- java/org/apache/commons/httpclient/HttpMethodBase.java	13 Oct 2003 12:19:22 -0000	1.159.2.14
+++ java/org/apache/commons/httpclient/HttpMethodBase.java	18 Oct 2003 18:35:32 -0000
@@ -2739,12 +2739,13 @@
         // make sure this is the initial invocation of the notification,
         // ignore subsequent ones.
         responseStream = null;
-        responseConnection.setLastResponseInputStream(null);
+        if (responseConnection != null) {
+            responseConnection.setLastResponseInputStream(null);
 
-        if (shouldCloseConnection(responseConnection)) {
-            responseConnection.close();
+            if (shouldCloseConnection(responseConnection)) {
+                responseConnection.close();
+            }
         }
-
         doneWithConnection = true;
         if (!inExecute) {
             ensureConnectionRelease();

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to