Author: toad
Date: 2008-08-08 11:19:14 +0000 (Fri, 08 Aug 2008)
New Revision: 21666

Modified:
   branches/db4o/freenet/src/freenet/support/io/BucketChainBucket.java
Log:
Don't throw ArrayIndexOutOfBounds on getInputStream() on an empty BCB.


Modified: branches/db4o/freenet/src/freenet/support/io/BucketChainBucket.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/io/BucketChainBucket.java 
2008-08-08 11:18:40 UTC (rev 21665)
+++ branches/db4o/freenet/src/freenet/support/io/BucketChainBucket.java 
2008-08-08 11:19:14 UTC (rev 21666)
@@ -67,7 +67,7 @@
        public InputStream getInputStream() throws IOException {
                synchronized(this) {
                        if(freed) throw new IOException("Freed");
-               }
+                       if(buckets.size() == 0) return new NullInputStream();
                return new InputStream() {

                        private int bucketNo = 0;
@@ -163,6 +163,7 @@
                        }

                };
+               }
        }

        protected synchronized InputStream getBucketInputStream(int i) throws 
IOException {


Reply via email to