You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/07/17 15:31:27 UTC

svn commit: r1362484 - /cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java

Author: dkulp
Date: Tue Jul 17 13:31:27 2012
New Revision: 1362484

URL: http://svn.apache.org/viewvc?rev=1362484&view=rev
Log:
[CXF-4356] Make sure close isn't called twice, thus wiping out the temp
file prematurely

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java?rev=1362484&r1=1362483&r2=1362484&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java Tue Jul 17 13:31:27 2012
@@ -464,9 +464,13 @@ public class CachedOutputStream extends 
         } else {
             try {
                 FileInputStream fileInputStream = new FileInputStream(tempFile) {
+                    boolean closed;
                     public void close() throws IOException {
-                        super.close();
-                        maybeDeleteTempFile(this);
+                        if (!closed) {
+                            super.close();
+                            maybeDeleteTempFile(this);
+                        }
+                        closed = true;
                     }
                 };
                 streamList.add(fileInputStream);