jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Lock token not removed when node is removed
Date Wed, 13 Feb 2008 12:46:34 GMT
Hi,

when I delete a locked node from the repository, the lock token
for this node is not removed from the session (I use a session scoped 
lock and remove the node in the same session).
Below is the test code.

Now, I think that in this case the lock token should be removed from the 
session. Another possibility would be to prevent the removal of a locked 
node, but I think just removing the lock token from the session is more 
natural.

WDYT?

     @org.junit.Test
     public void testLock() throws Exception {
         final Node parentNode = session.getRootNode();
         final Node node = parentNode.addNode("locktest", 
"nt:unstructured");
         node.addMixin("mix:lockable");
         parentNode.save();

         final Lock lock = node.lock(true, true);
         System.out.println("Lock token " + lock.getLockToken());
         node.remove();
         parentNode.save();
         final String[] tokens = session.getLockTokens();
         for(int i=0; i<tokens.length; i++) {
             System.out.println("Still: " + tokens[i]);
         }
     }

Carsten
-- 
Carsten Ziegeler
cziegeler@apache.org

Mime
View raw message