r9980 - helma/helma/trunk/src/helma/objectmodel/db

[email protected] Wed, 4 Nov 2009 11:56:15 +0100 (CET)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20091104105615.E7CFA3D0E2@mia>
Author: hannes
Date: 2009-11-04 11:56:15 +0100 (Wed, 04 Nov 2009)
New Revision: 9980

Modified:
   helma/helma/trunk/src/helma/objectmodel/db/Node.java
Log:
Create subnode list if it doesn't exist in Node.getLastSubnodeChange(). Fixes bug #679
http://dev.helma.org/bugs/show_bug.cgi?id=679

Details at http://dev.helma.org/trac/helma/changeset/9980

Modified: helma/helma/trunk/src/helma/objectmodel/db/Node.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/Node.java	2009-10-05 16:38:51 UTC (rev 9979)
+++ helma/helma/trunk/src/helma/objectmodel/db/Node.java	2009-11-04 10:56:15 UTC (rev 9980)
@@ -1038,19 +1038,16 @@
     }
 
     /**
-     *
-     *
-     * @param index ...
-     *
-     * @return ...
+     * 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 the subnode index
+     * @return the node at the given index
      */
     public INode getSubnodeAt(int index) {
         loadNodes();
-
         if (subnodes == null) {
             return null;
         }
-
         return subnodes.getNode(index);
     }
 
@@ -1452,7 +1449,10 @@
      */
     long getLastSubnodeChange() {
         // TODO check if we should compute this on demand
-        return subnodes == null ? 0 : subnodes.getLastSubnodeChange();
+        if (subnodes == null) {
+            createSubnodeList();
+        }
+        return subnodes.getLastSubnodeChange();
     }
 
     /**