Author: toad
Date: 2008-12-22 20:12:39 +0000 (Mon, 22 Dec 2008)
New Revision: 24754

Modified:
   branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
Log:
If no bytes left to read, return -1. Hopefully fix infinite loop in 
BucketTools.copy (wrapping a filechannel in a stream in a filechannel ...)


Modified: 
branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucket.java  
2008-12-22 19:48:53 UTC (rev 24753)
+++ branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucket.java  
2008-12-22 20:12:39 UTC (rev 24754)
@@ -88,6 +88,7 @@
                                if(bufOffset < 0) return -1; // throw new 
EOFException() ???
                                if(offset + length >= max)
                                        length = (int) Math.min(max - offset, 
Integer.MAX_VALUE);
+                               if(length == 0) return -1;
                                ByteBuffer buf = ByteBuffer.wrap(buffer, 
bufOffset, length);
                                int read = channel.read(buf, blockSize * index 
+ offset);
                                if(read > 0) offset += read;

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to