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

Lock holding nodes can be deleted.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • 2.4.0.Final, 2.2.1.GA
    • 2.2.1.GA
    • JCR

      The node that holds the lock can be deleted. No Exception is thrown even though the mixin=mix:lockable with a deep lock is present on the node.

      CODE:

      // Use the JPA connector (it's the same for the inmem connector).
      Session session1 = RepositoryReferenceFactory.getRepository("test-jpa").login();
      Session session2 = RepositoryReferenceFactory.getRepository("test-jpa").login();
      LockManager lm1 = session1.getWorkspace().getLockManager();

      // Create dir 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();

      // Lock the second node
      node2.addMixin("mix:lockable");
      session1.save();
      lm1.lock("/node1/node2", true, false, 10000, "Locked");
      session1.save();

      // Attempt to delete the locked node
      session2.refresh(true);
      Node toDelete = session2.getNode("/node1/node2");
      toDelete.remove();
      session2.save();

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

                Created:
                Updated:
                Resolved: