jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1405182 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
Date Fri, 02 Nov 2012 22:09:18 GMT
Author: mduerig
Date: Fri Nov  2 22:09:17 2012
New Revision: 1405182

URL: http://svn.apache.org/viewvc?rev=1405182&view=rev
Log:
OAK-421: NodeBuilder.reset might lead to inconsistent builder

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.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=1405182&r1=1405181&r2=1405182&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
Fri Nov  2 22:09:17 2012
@@ -265,7 +265,7 @@ public class MemoryNodeBuilder implement
         if (this == root) {
             baseState = checkNotNull(newBase);
             writeState = new MutableNodeState(baseState);
-            revision++;
+            revision = 0;
         } else {
             throw new IllegalStateException("Cannot reset a non-root builder");
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java?rev=1405182&r1=1405181&r2=1405182&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
Fri Nov  2 22:09:17 2012
@@ -128,4 +128,15 @@ public class MemoryNodeBuilderTest {
         assertFalse(root.child("x").hasChildNode("new"));
     }
 
+    @Test
+    public void testReset2() {
+        NodeBuilder root = new MemoryNodeBuilder(BASE);
+        NodeBuilder x = root.child("x");
+        NodeBuilder y = x.child("y");
+
+        root.reset(BASE);
+        assertTrue(root.hasChildNode("x"));
+        assertFalse(x.hasChildNode("y"));
+    }
+
 }



Mime
View raw message