Author: toad
Date: 2008-10-30 14:39:01 +0000 (Thu, 30 Oct 2008)
New Revision: 23226
Modified:
branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
Log:
Another ArrayIndexOutOfBounds, and a minor missing store().
Modified: branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
2008-10-30 14:00:22 UTC (rev 23225)
+++ branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
2008-10-30 14:39:01 UTC (rev 23226)
@@ -208,8 +208,10 @@
}
if(valid == 0 && exclude == 0) {
index = 0;
- if(persistent)
+ if(persistent) {
container.store(blocks[0]);
+
container.store(this);
+ }
if(logMINOR)
Logger.minor(this, "No valid or excluded items total "+index);
return null;
} else if(valid == 0) {
@@ -328,7 +330,7 @@
if(blocks.length == 1 || blockNo == endBlock) {
RandomGrabArrayItem[] items = blocks[blockNo].reqs;
int idx = index % BLOCK_SIZE;
- items[i] = items[idx];
+ items[i % BLOCK_SIZE] = items[idx];
items[idx] = null;
if(persistent)
container.store(blocks[blockNo]);