Author: j16sdiz
Date: 2008-09-04 16:56:04 +0000 (Thu, 04 Sep 2008)
New Revision: 22421
Modified:
trunk/freenet/src/freenet/support/io/BucketChainBucket.java
Log:
shouldn't buckets.set(i, bucket) -- it's freshly added!
Modified: trunk/freenet/src/freenet/support/io/BucketChainBucket.java
===================================================================
--- trunk/freenet/src/freenet/support/io/BucketChainBucket.java 2008-09-04
16:55:43 UTC (rev 22420)
+++ trunk/freenet/src/freenet/support/io/BucketChainBucket.java 2008-09-04
16:56:04 UTC (rev 22421)
@@ -255,9 +255,10 @@
protected OutputStream makeBucketOutputStream(int i) throws IOException
{
Bucket bucket = bf.makeBucket(bucketSize);
buckets.add(bucket);
- if(buckets.size() != i+1)
- throw new IllegalStateException("Added bucket, size
should be "+(i+1)+" but is "+buckets.size());
- buckets.set(i, bucket);
+ if (buckets.size() != i + 1)
+ throw new IllegalStateException("Added bucket, size
should be " + (i + 1) + " but is " + buckets.size());
+ if (buckets.get(i) != bucket)
+ throw new IllegalStateException("Bucket got replaced.
Race condition?");
return bucket.getOutputStream();
}