You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/08/12 17:08:46 UTC
svn commit: r803549 - in
/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock:
LockImpl.java LockManagerImpl.java XAEnvironment.java
Author: jukka
Date: Wed Aug 12 15:08:46 2009
New Revision: 803549
URL: http://svn.apache.org/viewvc?rev=803549&view=rev
Log:
JCR-1590: JSR 283: Locking
When readily available, add information about the locked node path to LockExceptions.
Modified:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java?rev=803549&r1=803548&r2=803549&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java Wed Aug 12 15:08:46 2009
@@ -106,10 +106,12 @@
*/
public void refresh() throws LockException, RepositoryException {
if (!isLive()) {
- throw new LockException("Lock is not live any more.");
+ throw new LockException(
+ "Lock is not live any more.", null, node.getPath());
}
if (!isLockOwningSession()) {
- throw new LockException("Session does not hold lock.");
+ throw new LockException(
+ "Session does not hold lock.", null, node.getPath());
}
// make sure the current session has sufficient privileges to refresh
// the lock.
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java?rev=803549&r1=803548&r2=803549&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java Wed Aug 12 15:08:46 2009
@@ -322,15 +322,20 @@
LockInfo other = element.get();
if (other != null) {
if (element.hasPath(path)) {
- throw new LockException("Node already locked: " + node);
+ throw new LockException(
+ "Node already locked: " + node, null,
+ node.getPath());
} else if (other.isDeep()) {
throw new LockException(
- "Parent node has a deep lock: " + node);
+ "Parent node has a deep lock: " + node, null,
+ session.getJCRPath(getPath(session, other.getId())));
}
}
if (info.isDeep() && element.hasPath(path)
&& element.getChildrenCount() > 0) {
- throw new LockException("Some child node is locked.");
+ throw new LockException(
+ "Some child node is locked.", null,
+ session.getJCRPath(getPath(session, other.getId())));
}
// create lock token
@@ -677,8 +682,8 @@
NodeId id = LockInfo.parseLockToken(lt);
NodeImpl node = (NodeImpl) sysSession.getItemManager().getItem(id);
- PathMap.Element<LockInfo> element =
- lockMap.map(node.getPrimaryPath(), true);
+ Path path = node.getPrimaryPath();
+ PathMap.Element<LockInfo> element = lockMap.map(path, true);
if (element != null) {
LockInfo info = element.get();
if (info != null) {
@@ -692,7 +697,8 @@
} else {
String msg = "Cannot add lock token: lock already held by other session.";
log.warn(msg);
- throw new LockException(msg);
+ throw new LockException(
+ msg, null, session.getJCRPath(path));
}
}
}
@@ -727,7 +733,8 @@
} else {
String msg = "Cannot remove lock token: lock held by other session.";
log.warn(msg);
- throw new LockException(msg);
+ throw new LockException(
+ msg, null, session.getJCRPath(getPath(session, id)));
}
}
}
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java?rev=803549&r1=803548&r2=803549&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java Wed Aug 12 15:08:46 2009
@@ -143,7 +143,7 @@
// verify node is not already locked.
if (isLocked(node)) {
- throw new LockException("Node locked.");
+ throw new LockException("Node locked.", null, node.getPath());
}
// create a new lock info for this node