Author: j16sdiz
Date: 2009-04-21 07:55:31 +0000 (Tue, 21 Apr 2009)
New Revision: 27136
Modified:
trunk/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
Log:
Check for closed
Modified: trunk/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
===================================================================
--- trunk/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
2009-04-21 07:55:08 UTC (rev 27135)
+++ trunk/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
2009-04-21 07:55:31 UTC (rev 27136)
@@ -88,6 +88,8 @@
@Override
public int read() throws IOException {
+ if (closed) throw new IOException("closed");
+
byte[] buf = new byte[1];
int res = read(buf);
if(res == -1) return -1;
@@ -96,6 +98,8 @@
@Override
public int read(byte[] buffer, int bufOffset, int
length) throws IOException {
+ if (closed) throw new IOException("closed");
+
long max;
synchronized(PersistentBlobTempBucket.this) {
if(freed) throw new IOException("Bucket
freed during read");
@@ -115,6 +119,7 @@
@Override
public int read(byte[] buffer) throws IOException {
+ if (closed) throw new IOException("closed");
return read(buffer, 0, buffer.length);
}
@@ -125,12 +130,13 @@
@Override
public void close() {
+ closed = true;
+
synchronized(PersistentBlobTempBucket.this) {
inputStreams--;
}
// Do nothing.
}
-
};
}
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs