jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1309307 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
Date Wed, 04 Apr 2012 09:52:13 GMT
Author: mduerig
Date: Wed Apr  4 09:52:12 2012
New Revision: 1309307

URL: http://svn.apache.org/viewvc?rev=1309307&view=rev
Log:
OAK-9: Internal tree builder
only mark items as removed which have an underlying (existing) item

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java?rev=1309307&r1=1309306&r2=1309307&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientNodeState.java
Wed Apr  4 09:52:12 2012
@@ -228,7 +228,9 @@ public class TransientNodeState {
 
     void removeNode(String name) {
         addedNodes.remove(name);
-        removedNodes.add(name);
+        if (hasExistingNode(name)) {
+            removedNodes.add(name);
+        }
     }
 
     void setProperty(PropertyState state) {
@@ -237,7 +239,9 @@ public class TransientNodeState {
 
     void removeProperty(String name) {
         addedProperties.remove(name);
-        removedProperties.add(name);
+        if (hasExistingProperty(name)) {
+            removedProperties.add(name);
+        }
     }
 
     void move(String name, TransientNodeState destParent, String destName) {
@@ -267,5 +271,13 @@ public class TransientNodeState {
         }
         return transientState;
     }
+    
+    private boolean hasExistingNode(String name) {
+        return persistentState != null && persistentState.getChildNode(name) != null;
+    }
+
+    private boolean hasExistingProperty(String name) {
+        return persistentState != null && persistentState.getProperty(name) != null;
+    }
 
 }



Mime
View raw message