Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-2807

ConcurrentModificationException in SessionItemStateManager.getIdOfRootTransientNodeState()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.2
    • 2.2
    • None
    • None

    Description

      SessionItemStateManager.getIdOfRootTransientNodeState() is throwing a ConcurrentModificationException on line 607:

      Here's a snippet of the 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);
                              }
                          }
      

      Can't use Collection.remove(Object) in the middle of iterating. It should probably be changed to use Iterator.remove():

                          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();
                              }
                          }
      

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

      Attachments

        Activity

          People

            stefan@jira Stefan Guggisberg
            wbustraan Weston Bustraan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: