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

                 Key: JCR-2667
                 URL: https://issues.apache.org/jira/browse/JCR-2667
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-core
    Affects Versions: 1.6.1
            Reporter: Cédric Damioli
            Priority: Critical
             Fix For: 1.6.3


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.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to