Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes ada5a4024 -> 6173368e9


[CXF-6115] Protecting CachedOutputStream against infinite loops when it works 
with Transferable streams - patch from Kyle Lape applied - This closes #32


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

Branch: refs/heads/2.7.x-fixes
Commit: 6173368e9888d107632ea7cb71c3d7fd349408fa
Parents: ada5a40
Author: Sergey Beryozkin <[email protected]>
Authored: Wed Nov 26 17:02:25 2014 +0000
Committer: Sergey Beryozkin <[email protected]>
Committed: Wed Nov 26 17:09:20 2014 +0000

----------------------------------------------------------------------
 api/src/main/java/org/apache/cxf/io/CachedOutputStream.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6173368e/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java 
b/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
index 6f9a6ec..bab9b32 100644
--- a/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
+++ b/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
@@ -680,7 +680,12 @@ public class CachedOutputStream extends OutputStream {
             if (!transfered) {
                 // Data is in memory, or we failed to rename the file, try 
copying
                 // the stream instead.
-                IOUtils.transferTo(getInputStream(), destinationFile);
+                FileOutputStream fout = new FileOutputStream(destinationFile);
+                try {
+                    IOUtils.copyAndCloseInput(this, fout);
+                } finally {
+                    fout.close();
+                }
             }
         }
     }

Reply via email to