Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 6e8b999f0 -> 9bb5448ae
[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/9bb5448a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9bb5448a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9bb5448a Branch: refs/heads/3.0.x-fixes Commit: 9bb5448ae60a806e69ee2c65f3dc10312f307472 Parents: 6e8b999 Author: Sergey Beryozkin <[email protected]> Authored: Wed Nov 26 17:02:25 2014 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Nov 26 17:04:04 2014 +0000 ---------------------------------------------------------------------- core/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/9bb5448a/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java b/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java index 441ea83..6bb597a 100644 --- a/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java +++ b/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java @@ -671,7 +671,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(); + } } } }
