Author: toad
Date: 2008-11-07 00:09:01 +0000 (Fri, 07 Nov 2008)
New Revision: 23370
Modified:
trunk/freenet/src/freenet/support/io/TempBucketFactory.java
Log:
Fix NPE
Modified: trunk/freenet/src/freenet/support/io/TempBucketFactory.java
===================================================================
--- trunk/freenet/src/freenet/support/io/TempBucketFactory.java 2008-11-06
23:02:17 UTC (rev 23369)
+++ trunk/freenet/src/freenet/support/io/TempBucketFactory.java 2008-11-07
00:09:01 UTC (rev 23370)
@@ -152,6 +152,7 @@
}
private class TempBucketOutputStream extends OutputStream {
+ boolean closed = false;
TempBucketOutputStream(short idx) throws IOException {
if(os == null)
os = currentBucket.getOutputStream();
@@ -208,7 +209,8 @@
public final void flush() throws IOException {
synchronized(TempBucket.this) {
_maybeMigrateRamBucket(currentSize);
- os.flush();
+ if(!closed)
+ os.flush();
}
}
@@ -219,6 +221,7 @@
os.flush();
os.close();
os = null;
+ closed = true;
}
}
}