Improper Exception thrown on concurrent versioned node changes
--------------------------------------------------------------

                 Key: JCR-1961
                 URL: https://issues.apache.org/jira/browse/JCR-1961
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-core, versioning
    Affects Versions: core 1.4.8
         Environment: ubuntu 7.10 - the Gutsy Gibbon Sun JDK 1.5.0_13
            Reporter: Micah Whitacre


When two sessions connected through two separate repositories but backed by the 
same database make non conflicting changes to the same versioned node, an 
InvalidItemStateException is thrown.  I'll attach a test project that when 
built displays this error but essentially the code is the following:

        Node node1 = session1.getRootNode().getNode(baseNodeName);
        Node node2 = session2.getRootNode().getNode(baseNodeName);

        node1.checkout();
        Node child1 = node1.addNode(UUID.randomUUID().toString(), "nt:folder");
        child1.addMixin("mix:versionable");
        child1.checkout();
        node1.save();
        child1.checkin();
        node1.checkin();

        node2.checkout();
        Node child2 = node2.addNode(UUID.randomUUID().toString(), "nt:folder");
        child2.addMixin("mix:versionable");
        child2.checkout();
        node2.save();
        child2.checkin();
        node2.checkin();

The above code throws the following exception on the node2.checkout() call.

javax.jcr.InvalidItemStateException: 
de6b39ce-1ec6-43e2-ba0e-2966341e6aff/{http://www.jcp.org/jcr/1.0}predecessors 
has been modified externally
        at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1251)
        at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:897)
        at org.apache.jackrabbit.core.NodeImpl.checkout(NodeImpl.java:3004)
        at 
concurrent.version.test.ConcurrentVersionNodeAddTest.testConcurrentNodeAdd(ConcurrentVersionNodeAddTest.java:89)

or

javax.jcr.InvalidItemStateException: 
e384b5f6-0fcd-4853-962c-0085901cdcce/{http://www.jcp.org/jcr/1.0}isCheckedOut 
has been modified externally
        at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1251)
        at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:897)
        at org.apache.jackrabbit.core.NodeImpl.checkout(NodeImpl.java:3004)
        at 
concurrent.version.test.ConcurrentVersionNodeAddTest.testConcurrentNodeAdd(ConcurrentVersionNodeAddTest.java:89)

Based on JCR-584[1], it would seem that since the change to the node is being 
merged properly that the versioning should be able to merge its information 
properly as well.  The difference between the merging of nodes and this version 
exception is the fact that one is a node and other are properties.  Now while I 
would like properties to be merged nicely (it would eliminate some other 
problems I'm having), since I can't control conflicting changes in how the 
versioning is managed it seems appropriate that it should merge nicely.  

[1] -https://issues.apache.org/jira/browse/JCR-584


-- 
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