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

Node.getPath() returns inconsistent values depending on whether node is saved or not

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6.4
    • 2.9
    • jackrabbit-core
    • None

    Description

      Consider following code:

      session.getRootNode().addNode(“foo”);
      session.save();
      Node fooNode = session.getNode("/foo");
      assertEquals("/foo", fooNode.getPath());
      session.move("/foo", "/bar");
      Node barNode = session.getNode("/bar");
      assertEquals(“/bar”, barNode.getPath()); <== this line actually fails, because barNode.getPath() still returns “/foo”
      

      From a repo point of view, move didn’t happen as it was not persisted yet. But the example above is working in single session and in that session move did happen, so “local” view should be consistent.

      Now aside from the weirdness of the above code, there is also consistency problem, because if I remove the save() call and run code like shown below, it will actually pass, so getPath() after move will behave differently whether or not was BEFORE the move persisted in the repo.

      session.getRootNode().addNode(“foo”);
      Node fooNode = session.getNode("/foo");
      assertEquals("/foo", fooNode.getPath());
      session.move("/foo", "/bar");
      Node barNode = session.getNode("/bar");
      assertEquals(“/bar”, barNode.getPath());
      

      As per comment from Stefan Guggisberg, this happens only at the root node level and is most likely caused by bug in CachingHierarchyManager and related to JCR-3239 and JCR-3368.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rah003 Jan Haderka
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: