jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1404599 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
Date Thu, 01 Nov 2012 14:04:36 GMT
Author: jukka
Date: Thu Nov  1 14:04:36 2012
New Revision: 1404599

URL: http://svn.apache.org/viewvc?rev=1404599&view=rev
Log:
OAK-413: TreeLocation.getStatus() cost increases as more content is read below this location

Allow an unconnected child builder to be acquired from a connected parent builder when that
child node has not yet been modified.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java?rev=1404599&r1=1404598&r2=1404599&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
Thu Nov  1 14:04:36 2012
@@ -69,7 +69,7 @@ import static org.apache.jackrabbit.oak.
  */
 public class MemoryNodeBuilder implements NodeBuilder {
 
-    static final NodeState NULL_STATE = new MemoryNodeState(
+    private static final NodeState NULL_STATE = new MemoryNodeState(
             ImmutableMap.<String, PropertyState>of(),
             ImmutableMap.<String, NodeState>of());
 
@@ -120,7 +120,7 @@ public class MemoryNodeBuilder implement
         this.name = checkNotNull(name);
 
         this.root = parent.root;
-        this.revision = parent.revision;
+        this.revision = -1;
 
         this.baseState = null;
         this.writeState = null;
@@ -173,7 +173,7 @@ public class MemoryNodeBuilder implement
         } else if (baseState != null) {
             return baseState;
         } else {
-            throw new IllegalStateException("This node does not exist");
+            return NULL_STATE;
         }
     }
 
@@ -368,7 +368,9 @@ public class MemoryNodeBuilder implement
     @Override
     public NodeBuilder child(String name) {
         read(); // shortcut when dealing with a read-only child node
-        if (writeState == null && baseState.hasChildNode(name)) {
+        if (baseState != null
+                && baseState.hasChildNode(name)
+                && (writeState == null || !writeState.nodes.containsKey(name))) {
             return createChildBuilder(name);
         }
 



Mime
View raw message