### Eclipse Workspace Patch 1.0 #P jackrabbit-core Index: src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (revision 668099) +++ src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (working copy) @@ -87,7 +87,7 @@ /** * System session */ - private final SessionImpl session; + private final SessionImpl sysSession; /** * Locks file @@ -119,7 +119,7 @@ public LockManagerImpl(SessionImpl session, FileSystem fs) throws RepositoryException { - this.session = session; + this.sysSession = session; this.resolver = session.getNamePathResolver(); this.locksFile = new FileSystemResource(fs, FileSystem.SEPARATOR + LOCKS_FILE); @@ -180,8 +180,8 @@ */ private void reapplyLock(LockToken lockToken) { try { - NodeImpl node = (NodeImpl) session.getItemManager().getItem(lockToken.id); - Path path = getPath(lockToken.id); + NodeImpl node = (NodeImpl) sysSession.getItemManager().getItem(lockToken.id); + Path path = getPath(sysSession, lockToken.id); LockInfo info = new LockInfo(lockToken, false, node.getProperty(NameConstants.JCR_LOCKISDEEP).getBoolean(), @@ -273,7 +273,8 @@ try { // check whether node is already locked - Path path = getPath(node.getId()); + + Path path = getPath(session, node.getId()); PathMap.Element element = lockMap.map(path, false); LockInfo other = (LockInfo) element.get(); @@ -333,7 +334,7 @@ // check whether node is locked by this session PathMap.Element element = lockMap.map( - getPath(node.getId()), true); + getPath(session, node.getId()), true); if (element == null) { throw new LockException("Node not locked: " + node.safeGetJCRPath()); } @@ -392,7 +393,7 @@ public AbstractLockInfo getLockInfo(NodeId id) throws RepositoryException { Path path; try { - path = getPath(id); + path = getPath(sysSession, id); } catch (ItemNotFoundException e) { return null; } @@ -434,7 +435,7 @@ try { SessionImpl session = (SessionImpl) node.getSession(); - Path path = getPath(node.getId()); + Path path = getPath(session, node.getId()); PathMap.Element element = lockMap.map(path, false); AbstractLockInfo info = (AbstractLockInfo) element.get(); @@ -496,7 +497,8 @@ acquire(); try { - PathMap.Element element = lockMap.map(getPath(node.getId()), true); + SessionImpl session = (SessionImpl) node.getSession(); + PathMap.Element element = lockMap.map(getPath(session, node.getId()), true); if (element == null) { return false; } @@ -516,7 +518,8 @@ acquire(); try { - PathMap.Element element = lockMap.map(getPath(node.getId()), true); + SessionImpl nodeSession = (SessionImpl) node.getSession(); + PathMap.Element element = lockMap.map(getPath(nodeSession, node.getId()), true); if (element == null) { return false; } @@ -536,7 +539,8 @@ acquire(); try { - Path path = getPath(node.getId()); + SessionImpl session = (SessionImpl) node.getSession(); + Path path = getPath(session, node.getId()); PathMap.Element element = lockMap.map(path, false); AbstractLockInfo info = (AbstractLockInfo) element.get(); @@ -562,7 +566,7 @@ throws LockException, RepositoryException { SessionImpl session = (SessionImpl) node.getSession(); - checkLock(getPath(node.getId()), session); + checkLock(getPath(session, node.getId()), session); } /** @@ -589,7 +593,7 @@ try { LockToken lockToken = LockToken.parse(lt); - NodeImpl node = (NodeImpl) this.session.getItemManager(). + NodeImpl node = (NodeImpl) session.getItemManager(). getItem(lockToken.id); PathMap.Element element = lockMap.map(node.getPrimaryPath(), true); if (element != null) { @@ -621,7 +625,7 @@ try { LockToken lockToken = LockToken.parse(lt); - NodeImpl node = (NodeImpl) this.session.getItemManager(). + NodeImpl node = (NodeImpl) session.getItemManager(). getItem(lockToken.id); PathMap.Element element = lockMap.map(node.getPrimaryPath(), true); if (element != null) { @@ -647,7 +651,7 @@ * Return the path of an item given its id. This method will lookup the * item inside the systme session. */ - private Path getPath(ItemId id) throws RepositoryException { + private Path getPath(SessionImpl session, ItemId id) throws RepositoryException { return session.getHierarchyManager().getPath(id); } @@ -871,7 +875,7 @@ for (int i = 0; i < infos.size(); i++) { LockInfo info = (LockInfo) infos.get(i); try { - NodeImpl node = (NodeImpl) session.getItemManager(). + NodeImpl node = (NodeImpl) sysSession.getItemManager(). getItem(info.getId()); lockMap.put(node.getPrimaryPath(), info); } catch (RepositoryException e) { @@ -1032,7 +1036,7 @@ acquire(); try { - Path path = getPath(nodeId); + Path path = getPath(sysSession, nodeId); // create lock token LockInfo info = new LockInfo(new LockToken(nodeId), false, isDeep, userId); @@ -1052,7 +1056,7 @@ acquire(); try { - Path path = getPath(nodeId); + Path path = getPath(sysSession, nodeId); PathMap.Element element = lockMap.map(path, true); if (element == null) { throw new LockException("Node not locked: " + path.toString());