Repository: cxf Updated Branches: refs/heads/master c772783a0 -> 336c67cd0
[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/336c67cd Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/336c67cd Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/336c67cd Branch: refs/heads/master Commit: 336c67cd0b8b3790c5fd99da79fa789094d623d6 Parents: c772783 Author: Sergey Beryozkin <[email protected]> Authored: Wed Nov 26 17:02:25 2014 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Nov 26 17:02:25 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/336c67cd/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(); + } } } }
