Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-1984

Calling Node.remove() on shareable node results in NodeSuchElementException when iterating over former parent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 3.4.0.Final, 3.3.x-prod-ip6.0
    • 3.3.0.Final
    • JCR
    • None
    • Hide
      • Create a shareable Node at path1 and save the session.
      • Clone the node to path2 and save the session.
      • Get the node by it's identifier and call Node.remove(), save the session.
      • Attempt to iterate over the children of path2, and the exception is thrown from NodeIterator.nextNode():
      	at org.modeshape.jcr.cache.document.ImmutableChildReferences$Segmented$2.next(ImmutableChildReferences.java:548) [modeshape-jcr-3.3.0.Final.jar:3.3.0.Final]
      	at org.modeshape.jcr.cache.document.ImmutableChildReferences$Segmented$2.next(ImmutableChildReferences.java:515) [modeshape-jcr-3.3.0.Final.jar:3.3.0.Final]
      	at org.modeshape.jcr.JcrChildNodeIterator.nextNode(JcrChildNodeIterator.java:112) [modeshape-jcr-3.3.0.Final.jar:3.3.0.Final]
      

      Sorry, I don't have a self-contained test case to provide.

      Show
      Create a shareable Node at path1 and save the session. Clone the node to path2 and save the session. Get the node by it's identifier and call Node.remove(), save the session. Attempt to iterate over the children of path2, and the exception is thrown from NodeIterator.nextNode(): at org.modeshape.jcr.cache.document.ImmutableChildReferences$Segmented$2.next(ImmutableChildReferences.java:548) [modeshape-jcr-3.3.0.Final.jar:3.3.0.Final] at org.modeshape.jcr.cache.document.ImmutableChildReferences$Segmented$2.next(ImmutableChildReferences.java:515) [modeshape-jcr-3.3.0.Final.jar:3.3.0.Final] at org.modeshape.jcr.JcrChildNodeIterator.nextNode(JcrChildNodeIterator.java:112) [modeshape-jcr-3.3.0.Final.jar:3.3.0.Final] Sorry, I don't have a self-contained test case to provide.

      If you call Node.remove() on a shareable node, and then attempt to iterate over the children of what was a formerly a parent of the node, a NoSuchElementException is thrown, making it impossible to access that Node's children.

      This does not happen when Node.removeSharedSet() is called, which is the work around.

      I'm not sure what the behavior should be when Node.remove() is called for a shareable node - perhaps either throw an exception, or just call Node.removeSharedSet().

              rhauch Randall Hauch (Inactive)
              jonathandfields_jira Jonathan Fields (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: