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 2009/03/12 03:58:14 UTC
svn commit: r752753 -
/cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
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);