Index: src/main/java/org/apache/jackrabbit/core/state/ItemState.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/state/ItemState.java (revision 602118) +++ src/main/java/org/apache/jackrabbit/core/state/ItemState.java (working copy) @@ -150,17 +150,18 @@ /** * Copy state information from another state into this state * @param state source state information + * @param syncModCount if the modCount should be synchronized. */ - protected abstract void copy(ItemState state); + protected abstract void copy(ItemState state, boolean syncModCount); /** * Pull state information from overlayed state. */ void pull() { - if (overlayedState != null) { - copy(overlayedState); + ItemState state = overlayedState; + if (state != null) { // sync modification count - modCount = overlayedState.getModCount(); + copy(state, true); } } @@ -168,8 +169,9 @@ * Push state information into overlayed state. */ void push() { - if (overlayedState != null) { - overlayedState.copy(this); + ItemState state = overlayedState; + if (state != null) { + state.copy(this, false); } } Index: src/main/java/org/apache/jackrabbit/core/state/NodeState.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/state/NodeState.java (revision 602118) +++ src/main/java/org/apache/jackrabbit/core/state/NodeState.java (working copy) @@ -136,7 +136,7 @@ /** * {@inheritDoc} */ - protected synchronized void copy(ItemState state) { + protected synchronized void copy(ItemState state, boolean syncModCount) { synchronized (state) { NodeState nodeState = (NodeState) state; id = nodeState.id; @@ -150,6 +150,9 @@ childNodeEntries = nodeState.childNodeEntries; sharedChildNodeEntries = true; nodeState.sharedChildNodeEntries = true; + if (syncModCount) { + setModCount(state.getModCount()); + } } } Index: src/main/java/org/apache/jackrabbit/core/state/PropertyState.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/state/PropertyState.java (revision 602118) +++ src/main/java/org/apache/jackrabbit/core/state/PropertyState.java (working copy) @@ -103,7 +103,7 @@ /** * {@inheritDoc} */ - protected synchronized void copy(ItemState state) { + protected synchronized void copy(ItemState state, boolean syncModCount) { synchronized (state) { PropertyState propState = (PropertyState) state; id = propState.id; @@ -111,6 +111,9 @@ defId = propState.defId; values = propState.values; multiValued = propState.multiValued; + if (syncModCount) { + setModCount(state.getModCount()); + } } } Index: src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java (revision 602118) +++ src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java (working copy) @@ -753,7 +753,7 @@ for (Iterator iter = shared.modifiedStates(); iter.hasNext();) { ItemState state = (ItemState) iter.next(); try { - state.copy(loadItemState(state.getId())); + state.copy(loadItemState(state.getId()), false); } catch (ItemStateException e) { state.discard(); } @@ -761,7 +761,7 @@ for (Iterator iter = shared.deletedStates(); iter.hasNext();) { ItemState state = (ItemState) iter.next(); try { - state.copy(loadItemState(state.getId())); + state.copy(loadItemState(state.getId()), false); } catch (ItemStateException e) { state.discard(); } @@ -924,8 +924,7 @@ if (state != null) { try { ItemState currentState = loadItemState(state.getId()); - state.copy(currentState); - state.setModCount(currentState.getModCount()); + state.copy(currentState, true); shared.modified(state); } catch (NoSuchItemStateException e) { // This is likely to happen because a subsequent delete