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

NodeReferences are lost when deleting and setting the same reference in the same save() cycle

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.6.1
    • 1.6.4
    • jackrabbit-core
    • None

    Description

      I've written the following snippet to illustrate the issue :

      Node root = session.getRootNode();

      Node a = root.addNode("a");
      Node b = root.addNode("b");
      b.addMixin("mix:referenceable");

      a.setProperty("p", b);

      root.save();

      System.out.println(b.getReferences().getSize()); // --> correctly returns 1

      a.setProperty("p", (Node) null);
      a.setProperty("p", b);

      root.save();

      System.out.println(b.getReferences().getSize()); // --> returns 0 !

      When the ChangeLog is processed, added references are processed before deleted ones, so the persisted NodeReferences is finally wrong.

      I've set the priority of this issue to critical, because the persisted references count is corrupted.

      A simple workaround is to first remove the property, then save, then add the property again, but it not satisfying.

      Attachments

        Activity

          People

            Unassigned Unassigned
            cdamioli Cédric Damioli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: