jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marvin Lau (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-2273) Lock.getLockToken() returns null for session scoped lock
Date Sun, 23 Aug 2009 01:09:14 GMT

    [ https://issues.apache.org/jira/browse/JCR-2273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12746535#action_12746535
] 

Marvin Lau commented on JCR-2273:
---------------------------------

JSR 170 specification for Lock.getLockTokenI() is also clear:

    "If this Session holds the lock token for this lock, then this method will return that
lock token. If this Session does not hold the applicable lock token then this method will
return null."

It's just different from JSR 283.  I thought Jackrabbit 1.6.0 was supposed to be JSR 170 compliant.

Anyway, I don't want to transfer the session scoped lock to another session.  I just want
to find out whether it is the current session that is holding the lock.  Is there any way
to do that with Jackrabbit 1.6.0?

> Lock.getLockToken() returns null for session scoped lock
> --------------------------------------------------------
>
>                 Key: JCR-2273
>                 URL: https://issues.apache.org/jira/browse/JCR-2273
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.6.0
>         Environment: Linux (Fedora 11), Sun JDK 1.5 (Java(TM) 2 Runtime Environment,
Standard Edition (build 1.5.0_16-b02))
>            Reporter: Marvin Lau
>
> The following code (part of a JUnit test) works in Jackrabbit 1.5.0 but fails in Jackrabbit
1.6.0 at the last line (assertNotNull("Failed to get lock token.", sessionLockToken)).  Is
this related to the work on JSR 283 where the behavior of Lock.getLockToken() has changed?
>             // Create lockable node
>             Node rootNode = session.getRootNode();
>             Node lockableNode = rootNode.addNode("foo");
>             rootNode.save();
>             lockableNode.addMixin(JcrConstants.MIX_LOCKABLE);
>             lockableNode.save();
>             session.save();
>             // Get an open scope lock on the node
>             lockableNode.lock(false, false);
>             // Get lock token
>             Lock lock = lockableNode.getLock();
>             String openLockToken = lock.getLockToken();
>             assertNotNull("Failed to get lock token.", openLockToken);
>             // Remove the lock token by unlocking
>             lockableNode.unlock();
>             // Get a session scope lock on the node
>             lockableNode.lock(false, true);
>             // Get lock token
>             lock = lockableNode.getLock();
>             String sessionLockToken = lock.getLockToken();
>             assertNotNull("Failed to get lock token.", sessionLockToken);

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