cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [1/2] git commit: [CXF-5763] Make sure the stream is only closed once
Date Mon, 16 Jun 2014 18:37:37 GMT
Repository: cxf
Updated Branches:
  refs/heads/master da25b2af7 -> 99295330d


[CXF-5763] Make sure the stream is only closed once


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d3d7a359
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d3d7a359
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d3d7a359

Branch: refs/heads/master
Commit: d3d7a35954d01b42fbe5bc54a3fac09c8aef43b0
Parents: da25b2a
Author: Daniel Kulp <dkulp@apache.org>
Authored: Mon Jun 16 14:16:26 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Mon Jun 16 14:16:26 2014 -0400

----------------------------------------------------------------------
 .../cxf/transport/http/asyncclient/AsyncHTTPConduit.java      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d3d7a359/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
index 96c5396..e09cb14 100644
--- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
+++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
@@ -263,6 +263,7 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit {
         private Future<Boolean> connectionFuture;
 
         private Object sessionLock = new Object();
+        private boolean closed;
         
         public AsyncWrappedOutputStream(Message message,
                                         boolean needToCacheRequest, 
@@ -393,7 +394,11 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit {
         
         @Override
         public void close() throws IOException {
-            if (!chunking && wrappedStream != null) {
+            if (closed) {
+                return;
+            }
+            closed = true;
+            if (!chunking && wrappedStream instanceof CachedOutputStream) {
                 CachedOutputStream out = (CachedOutputStream)wrappedStream;
                 this.basicEntity.setContentLength(out.size());
                 wrappedStream = null;


Mime
View raw message