jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weston Bustraan (JIRA)" <j...@apache.org>
Subject [jira] Created: (JCR-2807) ConcurrentModificationException in SessionItemStateManager.getIdOfRootTransientNodeState()
Date Sat, 06 Nov 2010 13:05:44 GMT
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


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