Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-1040

An attempt to delete a child node of a node which holds an open-scoped shallow lock results in a LockException.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 2.2.1.GA
    • JCR
    • None

      Running the following code throws a LockException instead of deleting the node. The following code was tested using the JPA and InMemory connector.

      CODE:

      Session session1 = RepositoryReferenceFactory.getRepository("test-jpa").login();
      Session session2 = RepositoryReferenceFactory.getRepository("test-jpa").login();
      LockManager lm1 = session1.getWorkspace().getLockManager();

      // Create node structure
      Node root1 = session1.getRootNode();
      Node node1 = root1.addNode("node1", "nt:folder");
      Node node2 = root1.addNode("node1/node2", "nt:folder");
      Node node3 = root1.addNode("node1/node2/node3", "nt:folder");
      session1.save();

      // Create an open-scoped shallow lock on node2
      node2.addMixin("mix:lockable");
      session1.save();
      lm1.lock("/node1/node2", false, false, 10000, "Locked");
      session1.save();

      // Attempt to a child node of node2
      session2.refresh(true);
      Node toDelete = session2.getNode("/node1/node2/node3");
      toDelete.remove();
      session2.save();

      Exception Stack:

      javax.jcr.lock.LockException: The node at location '</{}node1/{}node2/{}node3 && [

      {http://www.modeshape.org/1.0}

      uuid = 9c1a99f0-8710-4c61-b058-729835b88f8e]>' is not locked
      org.modeshape.jcr.JcrLockManager.getLock(JcrLockManager.java:88)
      at org.modeshape.jcr.JcrNode.doRemove(JcrNode.java:111)
      at org.modeshape.jcr.AbstractJcrNode.removeShare(AbstractJcrNode.java:2386)
      at org.modeshape.jcr.AbstractJcrNode.remove(AbstractJcrNode.java:2431)
      at org.jboss.soa.modeshape.qa.tests.GenericConnectorLockingTest.testLockingBug1(GenericConnectorLockingTest.java:90)
      25 lines not shown

              bcarothers_jira Brian Carothers (Inactive)
              mbaluch@redhat.com Marek Baluch
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: