jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Reschke (JIRA)" <j...@apache.org>
Subject [jira] Updated: (JCR-1040) JCR2SPI: remove node operation missing in submitted SPI batch
Date Tue, 31 Jul 2007 13:25:57 GMT

     [ https://issues.apache.org/jira/browse/JCR-1040?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Julian Reschke updated JCR-1040:
--------------------------------


Angela S. pointed out that the removed node "/a" should be in the attic, but isn't. A similar
case is a move() operation, such as:

1) move "/a" to "/a2"
2) add "/a"
3) add "/a/b" 

Turns out that this doesn't work either. Test case:

      if (session.getRepository().getDescriptor(Repository.LEVEL_2_SUPPORTED).equals("true"))
{
        Node testnode;
        String name = "delete-test";
          
        Node root = session.getRootNode();
        
        // make sure it's there
        if (! root.hasNode(name)) {
          root.addNode(name, "nt:folder");
          session.save();
        }

        // make sure target is not there
        if (root.hasNode(name + "2")) {
          root.getNode(name + "2").remove();
          session.save();
        }
        
        // now test remove/add in one batch
        if (root.hasNode(name)) {
          testnode = root.getNode(name);
          session.move("/" + name, "/" + name + "2");
          // session.save(); // un-commenting this makes the test pass
        }
        
        testnode = root.addNode(name, "nt:folder");
        // add one child
        testnode.addNode(name, "nt:folder"); // commenting this out makes the test pass
        
        session.save();
      }
      
This fails with:

javax.jcr.nodetype.ConstraintViolationException: ChangeLog is not self contained.
	at org.apache.jackrabbit.jcr2spi.state.ChangeLog.checkIsSelfContained(ChangeLog.java:364)
	at org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.getChangeLog(SessionItemStateManager.java:567)
	at org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(SessionItemStateManager.java:145)
	at org.apache.jackrabbit.jcr2spi.ItemImpl.save(ItemImpl.java:239)
	at org.apache.jackrabbit.jcr2spi.SessionImpl.save(SessionImpl.java:317)
	at com.xythos.jcr.NodeCreationRemovalTest.testMoveAddInRoot(NodeCreationRemovalTest.java:475)





> JCR2SPI: remove node operation missing in submitted SPI batch
> -------------------------------------------------------------
>
>                 Key: JCR-1040
>                 URL: https://issues.apache.org/jira/browse/JCR-1040
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: SPI
>            Reporter: Julian Reschke
>
> In JCR2SPI, the following sequence of operations seems to lead to an incorrect SPI batch
being submitted:
> 1) remove "/a"
> 2) add "/a"
> 3) add "/a/b"
> 4) session.save()
> This seems to create an SPI batch where the first remove operation is missing.
> Note that the problem only seems to occur when step 3 is part of the sequence.
> Full Java source for test:
>     try {
>       if (session.getRepository().getDescriptor(Repository.LEVEL_2_SUPPORTED).equals("true"))
{
>         Node testnode;
>         String name = "delete-test";
>           
>         Node root = session.getRootNode();
>         
>         // make sure it's there
>         if (! root.hasNode(name)) {
>           root.addNode(name, "nt:folder");
>           session.save();
>         }
>         
>         // now test remove/add in one batch
>         if (root.hasNode(name)) {
>           testnode = root.getNode(name);
>           testnode.remove();
>           // session.save(); // un-commenting this makes the test pass
>         }
>         
>         testnode = root.addNode(name, "nt:folder");
>         // add one child
>         testnode.addNode(name, "nt:folder"); // commenting this out makes the test pass
>         
>         session.save();
>       }
>     } finally {
>       session.logout();
>     }
>     
>     

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


Mime
View raw message