jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1365940 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java
Date Thu, 26 Jul 2012 10:39:16 GMT
Author: jukka
Date: Thu Jul 26 10:39:15 2012
New Revision: 1365940

URL: http://svn.apache.org/viewvc?rev=1365940&view=rev
Log:
OAK-167: Caching NodeStore implementation

Throw IllegalStateException when trying to access a builder for a node that has meanwhile
been removed.
Kudos to Michi for the idea.

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java?rev=1365940&r1=1365939&r2=1365940&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStateBuilder.java
Thu Jul 26 10:39:15 2012
@@ -134,7 +134,9 @@ public class MemoryNodeStateBuilder impl
             if (pstate != null) {
                 MutableNodeState mstate = pstate.nodes.get(name);
                 if (mstate == null && pstate.nodes.containsKey(name)) {
-                    mstate = new MutableNodeState(NULL_STATE);
+                    throw new IllegalStateException(
+                            "This builder refers to a node that has"
+                            + " been removed from it's parent.");
                 }
                 if (mstate != null) {
                     parent = null;
@@ -153,11 +155,12 @@ public class MemoryNodeStateBuilder impl
             MutableNodeState mstate = pstate.nodes.get(name);
             if (mstate == null) {
                 if (pstate.nodes.containsKey(name)) {
-                    mstate = new MutableNodeState(NULL_STATE);
-                } else {
-                    mstate = new MutableNodeState(readState);
-                    pstate.nodes.put(name, mstate);
+                    throw new IllegalStateException(
+                            "This builder refers to a node that has"
+                            + " been removed from it's parent.");
                 }
+                mstate = new MutableNodeState(readState);
+                pstate.nodes.put(name, mstate);
             }
             parent = null;
             name = null;



Mime
View raw message