Create subnode list if it doesn't exist in Node.getLastSubnodeChange(). Fixes bug #679

http://dev.helma.org/bugs/show_bug.cgi?id=679
This commit is contained in:
hns 2009-11-04 10:56:15 +00:00
parent f2904d1f29
commit daf3b0b292

View file

@ -1038,19 +1038,16 @@ public final class Node implements INode {
} }
/** /**
* * Get a node at a given position. This causes the subnode list to be loaded in case
* * it isn't up to date.
* @param index ... * @param index the subnode index
* * @return the node at the given index
* @return ...
*/ */
public INode getSubnodeAt(int index) { public INode getSubnodeAt(int index) {
loadNodes(); loadNodes();
if (subnodes == null) { if (subnodes == null) {
return null; return null;
} }
return subnodes.getNode(index); return subnodes.getNode(index);
} }
@ -1452,7 +1449,10 @@ public final class Node implements INode {
*/ */
long getLastSubnodeChange() { long getLastSubnodeChange() {
// TODO check if we should compute this on demand // TODO check if we should compute this on demand
return subnodes == null ? 0 : subnodes.getLastSubnodeChange(); if (subnodes == null) {
createSubnodeList();
}
return subnodes.getLastSubnodeChange();
} }
/** /**