jackrabbit-commits mailing list archives

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

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

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

Modified: jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=1439318&r1=1439317&r2=1439318&view=diff
==============================================================================
--- jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Mon Jan 28 09:26:46 2013
@@ -677,14 +677,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