jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: r1439314 - /jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Date Mon, 28 Jan 2013 09:22:52 GMT
Author: unico
Date: Mon Jan 28 09:22:52 2013
New Revision: 1439314

URL: http://svn.apache.org/viewvc?rev=1439314&view=rev
Log:
JCR-3502 don't fail when deleting a node that was already deleted externally

Modified:
    jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java

Modified: jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=1439314&r1=1439313&r2=1439314&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Mon Jan 28 09:22:52 2013
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.core.state
 
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -685,14 +686,21 @@ public class SharedItemStateManager
 
                     shared.modified(state.getOverlayedState());
                 }
-                for (ItemState state : local.deletedStates()) {
-                    state.connect(getItemState(state.getId()));
-                    if (state.isStale()) {
-                        String msg = state.getId() + " has been modified externally";
-                        log.debug(msg);
-                        throw new StaleItemStateException(msg);
+                Iterator<ItemState> deleted = local.deletedStates().iterator();
+                while (deleted.hasNext()) {
+                    ItemState state = deleted.next();
+                    try {
+                        state.connect(getItemState(state.getId()));
+                        if (state.isStale()) {
+                            String msg = state.getId() + " has been modified externally";
+                            log.debug(msg);
+                            throw new StaleItemStateException(msg);
+                        }
+                        shared.deleted(state.getOverlayedState());
+                    } catch (NoSuchItemStateException e) {
+                        // item state was already deleted externally
+                        deleted.remove();
                     }
-                    shared.deleted(state.getOverlayedState());
                 }
                 for (ItemState state : local.addedStates()) {
                     if (state.isNode() && state.getStatus() != ItemState.STATUS_NEW)
{



Mime
View raw message