Fixed emberassing bug in prefetchChildren() array index calculation.

(I knew I was too overworked when I wrote the code!)
This commit is contained in:
hns 2002-09-25 12:42:53 +00:00
parent a358574fed
commit 04bcc845ef

View file

@ -1249,12 +1249,15 @@ public final class Node implements INode, Serializable {
loadNodes (); loadNodes ();
if (subnodes == null) if (subnodes == null)
return; return;
if (startIndex >= subnodes.size())
return;
int l = Math.min (subnodes.size()-startIndex, length); int l = Math.min (subnodes.size()-startIndex, length);
if (l < 1) if (l < 1)
return; return;
Key[] keys = new Key[l]; Key[] keys = new Key[l];
for (int i=startIndex; i<startIndex+l; i++) for (int i=0; i<l; i++) {
keys[i] = ((NodeHandle) subnodes.get (i)).getKey (); keys[i] = ((NodeHandle) subnodes.get (i+startIndex)).getKey ();
}
nmgr.nmgr.prefetchNodes (this, dbmap.getSubnodeRelation (), keys); nmgr.nmgr.prefetchNodes (this, dbmap.getSubnodeRelation (), keys);
} }