jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sch...@apache.org
Subject svn commit: r1327464 - in /jackrabbit/branches/2.2: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java
Date Wed, 18 Apr 2012 12:04:43 GMT
Author: schans
Date: Wed Apr 18 12:04:43 2012
New Revision: 1327464

URL: http://svn.apache.org/viewvc?rev=1327464&view=rev
Log:
JCR-3289: Fix data inconsistency when remove operation is performed after move operation (merged
from trunk)

Added:
    jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java
      - copied, changed from r1311861, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java
Modified:
    jackrabbit/branches/2.2/   (props changed)
    jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java

Propchange: jackrabbit/branches/2.2/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1311861

Modified: jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java?rev=1327464&r1=1327463&r2=1327464&view=diff
==============================================================================
--- jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java
Wed Apr 18 12:04:43 2012
@@ -712,12 +712,15 @@ class ItemSaveOperation implements Sessi
      * definitively remove each one
      */
     private void removeTransientItems(
-            SessionItemStateManager sism, Iterable<ItemState> states) {
+            SessionItemStateManager sism, Iterable<ItemState> states) throws StaleItemStateException
{
         for (ItemState transientState : states) {
             ItemState persistentState = transientState.getOverlayedState();
             // remove persistent state
             // this will indirectly (through stateDestroyed listener method)
             // permanently invalidate all Item instances wrapping it
+            if (transientState.getModCount() != persistentState.getModCount()) {
+                throw new StaleItemStateException(transientState.getId() + " has been modified
externally");
+            }
             sism.destroy(persistentState);
         }
     }

Copied: jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java
(from r1311861, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java?p2=jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java&p1=jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java&r1=1311861&r2=1327464&rev=1327464&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveRemoveTest.java
Wed Apr 18 12:04:43 2012
@@ -21,7 +21,6 @@ import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.jackrabbit.core.persistence.check.ConsistencyReport;
 import org.apache.jackrabbit.core.state.StaleItemStateException;
 import org.apache.jackrabbit.test.AbstractJCRTest;
 import org.apache.jackrabbit.test.NotExecutableException;
@@ -50,15 +49,11 @@ public class MoveRemoveTest extends Abst
         session1.save();
         try {
             session2.save();
+            fail("Save should not succeed as it is conflicting");
         } catch (InvalidItemStateException e) {
             if (e.getCause() == null || e.getCause().getClass() != StaleItemStateException.class)
{
                 throw e;
             }
         }
-        ConsistencyReport consistencyReport = TestHelper.checkConsistency(testRootNode.getSession(),
false, null);
-        //for (ReportItem item : consistencyReport.getItems()) {
-        //    System.out.println(item.getMessage());
-        //}
-        assertTrue(consistencyReport.getItems().size() == 0);
     }
 }



Mime
View raw message