You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by gd...@apache.org on 2009/07/12 05:14:36 UTC

svn commit: r793263 - /webservices/axis2/branches/java/1_5/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java

Author: gdaniels
Date: Sun Jul 12 03:14:36 2009
New Revision: 793263

URL: http://svn.apache.org/viewvc?rev=793263&view=rev
Log:
Guard against "attempted read from closed stream" error - you REALLY shouldn't be auto-releasing for synchronous request/response clients, so make sure AUTO_RELEASE_CONNECTION doesn't break things in that case.

Modified:
    webservices/axis2/branches/java/1_5/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java

Modified: webservices/axis2/branches/java/1_5/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_5/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java?rev=793263&r1=793262&r2=793263&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_5/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java (original)
+++ webservices/axis2/branches/java/1_5/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java Sun Jul 12 03:14:36 2009
@@ -22,6 +22,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.description.OutInAxisOperation;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.i18n.Messages;
@@ -111,8 +112,13 @@
 
     private void cleanup(MessageContext msgContext, HttpMethod method) {
         if (msgContext.isPropertyTrue(HTTPConstants.AUTO_RELEASE_CONNECTION)) {
-            log.trace("AutoReleasing " + method);
-            method.releaseConnection();
+            // Protect against synchronously waiting for a response, in which case
+            // this would result in trying to read a closed stream...!
+            if (!(msgContext.getAxisOperation() instanceof OutInAxisOperation) ||
+                msgContext.getOptions().isUseSeparateListener()) {
+                log.trace("AutoReleasing " + method);
+                method.releaseConnection();
+            }
         }
     }