jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sch...@apache.org
Subject svn commit: r1327441 - in /jackrabbit/branches/2.4: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionMoveOperation.java jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentCyclicMoveTest.java
Date Wed, 18 Apr 2012 10:14:55 GMT
Author: schans
Date: Wed Apr 18 10:14:54 2012
New Revision: 1327441

URL: http://svn.apache.org/viewvc?rev=1327441&view=rev
Log:
JCR-3291: Prevent the creation of cyclic paths in the transient and persistent states (merge
from trunk)

Added:
    jackrabbit/branches/2.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentCyclicMoveTest.java
      - copied unchanged from r1327432, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentCyclicMoveTest.java
Modified:
    jackrabbit/branches/2.4/   (props changed)
    jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionMoveOperation.java

Propchange: jackrabbit/branches/2.4/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1327432

Modified: jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionMoveOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionMoveOperation.java?rev=1327441&r1=1327440&r2=1327441&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionMoveOperation.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionMoveOperation.java
Wed Apr 18 10:14:54 2012
@@ -190,6 +190,10 @@ public class SessionMoveOperation implem
             NodeState destParentState =
                 (NodeState) destParentNode.getOrCreateTransientItemState();
 
+            // Create the transient parent nodes of the target node to prevent 
+            // conflicting and/or cyclic moves. See JCR-3921
+            createTransientParentStates(destParentNode);
+            
             // do move:
             // 1. remove child node entry from old parent
             if (srcParentState.removeChildNodeEntry(targetId)) {
@@ -203,6 +207,12 @@ public class SessionMoveOperation implem
         return this;
     }
 
+    private void createTransientParentStates(NodeImpl node) throws RepositoryException {
+        while (node.getParentId() != null) {
+            node.getOrCreateTransientItemState();
+            node = (NodeImpl) node.getParent();
+        }
+    }
 
     //--------------------------------------------------------------< Object >
 



Mime
View raw message