jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-2807) ConcurrentModificationException in SessionItemStateManager.getIdOfRootTransientNodeState()
Date Sat, 06 Nov 2010 14:01:42 GMT

    [ https://issues.apache.org/jira/browse/JCR-2807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12928972#action_12928972
] 

Stefan Guggisberg commented on JCR-2807:
----------------------------------------

> Any idea what I could do differently to workaround the issue?

this code is only executed when the current session doesn't 
have read permission on root node.

so either grant read access on root or call save() on the
'dirty' node directly instead of calling session.save() or
rootNode.Save().

> ConcurrentModificationException in SessionItemStateManager.getIdOfRootTransientNodeState()
> ------------------------------------------------------------------------------------------
>
>                 Key: JCR-2807
>                 URL: https://issues.apache.org/jira/browse/JCR-2807
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>            Reporter: Weston Bustraan
>            Assignee: Stefan Guggisberg
>
> SessionItemStateManager.getIdOfRootTransientNodeState() is throwing a ConcurrentModificationException
on line 607:
> Here's a snippet of the code:
> {code}
>                     for (NodeId id : candidateIds) {
>                         if (nodeId.equals(id) || hierMgr.isAncestor(id, nodeId)) {
>                             // already a candidate or a descendant thereof
>                             // => skip
>                             skip = true;
>                             break;
>                         }
>                         if (hierMgr.isAncestor(nodeId, id)) {
>                             // candidate is a descendant => remove
>                             candidateIds.remove(id);
>                         }
>                     }
> {code}
> Can't use Collection.remove(Object) in the middle of iterating. It should probably be
changed to use Iterator.remove():
> {code}
>                     Iterator<NodeId> nodeIdItor = candidateIds.iterator();
>                     while (nodeIdItor.hasNext()) {
>                         NodeId id = nodeIdItor.next();
>                         if (nodeId.equals(id) || hierMgr.isAncestor(id, nodeId)) {
>                             // already a candidate or a descendant thereof
>                             // => skip
>                             skip = true;
>                             break;
>                         }
>                         if (hierMgr.isAncestor(nodeId, id)) {
>                             // candidate is a descendant => remove
>                             nodeIdItor.remove();
>                         }
>                     }
> {code}
> Any idea what I could do differently to workaround the issue?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message