jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1453307 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
Date Wed, 06 Mar 2013 12:05:52 GMT
Author: mduerig
Date: Wed Mar  6 12:05:52 2013
New Revision: 1453307

URL: http://svn.apache.org/r1453307
Log:
OAK-614: AssertionError in MemoryNodeBuilder
clarify: better method and parameter names, correct comment

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=1453307&r1=1453306&r2=1453307&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
Wed Mar  6 12:05:52 2013
@@ -189,13 +189,13 @@ public class MemoryNodeBuilder implement
     }
 
     /**
-     * Determine whether this child exists with its direct parent or existed with its direct
-     * parent and got disconnected.
-     * @return  {@code true} iff this child either exists or got disconnected from its direct
parent.
+     * Determine whether this child exists at its direct parent.
+     * @return  {@code true} iff this child exists at its direct parent.
      */
-    private boolean existsOrDisconnected() {
-        // No need to check the base state. The fact that we have this
-        // builder instance proofs that this child existed at some point.
+    private boolean exists() {
+        // No need to check the base state if write state is null. The fact that we have
this
+        // builder instance proofs that this child existed at some point as it must have
been
+        // retrieved from the base state.
         return isRoot() || parent.writeState == null || parent.writeState.hasChildNode(name);
     }
 
@@ -206,7 +206,7 @@ public class MemoryNodeBuilder implement
     private boolean updateReadState() {
         if (revision != root.revision) {
             assert(!isRoot()); // root never gets here since revision == root.revision
-            if (!existsOrDisconnected()) {
+            if (!exists()) {
                 return false;
             }
             parent.updateReadState();
@@ -235,11 +235,11 @@ public class MemoryNodeBuilder implement
     }
 
     @Nonnull
-    private MutableNodeState write(long newRevision, boolean skipRemovedCheck) {
+    private MutableNodeState write(long newRevision, boolean reconnect) {
         // make sure that all revision numbers up to the root gets updated
         if (!isRoot()) {
-            checkState(skipRemovedCheck || existsOrDisconnected(), "This node has been removed");
-            parent.write(newRevision, skipRemovedCheck);
+            checkState(reconnect || exists(), "This node has been removed");
+            parent.write(newRevision, reconnect);
         }
 
         if (writeState == null || revision != root.revision) {
@@ -250,7 +250,7 @@ public class MemoryNodeBuilder implement
 
             writeState = parent.getWriteState(name);
             if (writeState == null) {
-                if (existsOrDisconnected()) {
+                if (exists()) {
                     assert baseState != null;
                     writeState = new MutableNodeState(baseState);
                 }



Mime
View raw message