cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r752753 - /cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
Date Thu, 12 Mar 2009 02:58:14 GMT
Author: dkulp
Date: Thu Mar 12 02:58:14 2009
New Revision: 752753

URL: http://svn.apache.org/viewvc?rev=752753&view=rev
Log:
[CXF-2106] Attempt to make sure stream is closed so file will delete

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=752753&r1=752752&r2=752753&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 Thu Mar 12 02:58:14
2009
@@ -152,8 +152,17 @@
      * @throws IOException
      */
     public void lockOutputStream() throws IOException {
+        if (outputLocked) {
+            return;
+        }
         currentStream.flush();
         outputLocked = true;
+        if (null != callbacks) {
+            for (CachedOutputStreamCallback cb : callbacks) {
+                cb.onClose(this);
+            }
+        }
+        doClose();
         streamList.remove(currentStream);
     }
     
@@ -430,6 +439,14 @@
     private void maybeDeleteTempFile(Object stream) {
         streamList.remove(stream);
         if (!inmem && tempFile != null && streamList.isEmpty()) {
+            if (currentStream != null) {
+                try {
+                    currentStream.close();
+                    postClose();
+                } catch (Exception e) {
+                    //ignore
+                }
+            }
             tempFile.delete();
             tempFile = null;
             currentStream = new LoadingByteArrayOutputStream(1024);



Mime
View raw message