Author: toad
Date: 2007-03-31 16:09:02 +0000 (Sat, 31 Mar 2007)
New Revision: 12475
Modified:
trunk/freenet/src/freenet/support/io/FileBucket.java
Log:
Fix DDA: FileBucket$FileBucketOutputStream.close() twice didn't work.
Modified: trunk/freenet/src/freenet/support/io/FileBucket.java
===================================================================
--- trunk/freenet/src/freenet/support/io/FileBucket.java 2007-03-31
16:01:05 UTC (rev 12474)
+++ trunk/freenet/src/freenet/support/io/FileBucket.java 2007-03-31
16:09:02 UTC (rev 12475)
@@ -166,6 +166,7 @@
private long restartCount;
private File tempfile;
+ private boolean closed;
protected FileBucketOutputStream(
File tempfile, String s, long restartCount)
@@ -176,6 +177,7 @@
this.tempfile = tempfile;
resetLength();
this.restartCount = restartCount;
+ closed = false;
}
protected void confirmWriteSynchronized() throws IOException {
@@ -210,6 +212,10 @@
}
public void close() throws IOException {
+ synchronized(this) {
+ if(closed) return;
+ closed = true;
+ }
boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
if(logMINOR)
Logger.minor(this, "Closing "+FileBucket.this);