Index: src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (revision 772055) +++ src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (working copy) @@ -135,7 +135,7 @@ /** * System session */ - private final SessionImpl session; + private final SessionImpl sysSession; /** * Locks file @@ -162,7 +162,7 @@ public LockManagerImpl(SessionImpl session, FileSystem fs) throws RepositoryException { - this.session = session; + this.sysSession = session; this.locksFile = new FileSystemResource(fs, FileSystem.SEPARATOR + LOCKS_FILE); session.getWorkspace().getObservationManager(). @@ -217,8 +217,8 @@ private void reapplyLock(LockToken lockToken) { try { NodeImpl node = (NodeImpl) - session.getItemManager().getItem(lockToken.getId()); - Path path = getPath(lockToken.getId()); + sysSession.getItemManager().getItem(lockToken.getId()); + Path path = getPath(sysSession, lockToken.getId()); LockInfo info = new LockInfo(lockToken, false, node.getProperty(NameConstants.JCR_LOCKISDEEP).getBoolean(), @@ -315,7 +315,7 @@ 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(); @@ -376,7 +376,7 @@ try { SessionImpl session = (SessionImpl) node.getSession(); // check whether node is locked by this session - PathMap.Element element = lockMap.map(getPath(node.getId()), true); + PathMap.Element element = lockMap.map(getPath(session, node.getId()), true); if (element == null) { throw new LockException("Node not locked: " + node); } @@ -437,7 +437,7 @@ public AbstractLockInfo getLockInfo(NodeId id) throws RepositoryException { Path path; try { - path = getPath(id); + path = getPath(sysSession, id); } catch (ItemNotFoundException e) { return null; } @@ -485,7 +485,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(); @@ -543,7 +543,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; } @@ -563,7 +564,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; } @@ -583,7 +585,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(); @@ -609,7 +612,7 @@ throws LockException, RepositoryException { SessionImpl session = (SessionImpl) node.getSession(); - checkLock(getPath(node.getId()), session); + checkLock(getPath(session, node.getId()), session); } /** @@ -637,7 +640,7 @@ LockToken lockToken = LockToken.parse(lt); NodeImpl node = (NodeImpl) - this.session.getItemManager().getItem(lockToken.getId()); + this.sysSession.getItemManager().getItem(lockToken.getId()); PathMap.Element element = lockMap.map(node.getPrimaryPath(), true); if (element != null) { AbstractLockInfo info = (AbstractLockInfo) element.get(); @@ -671,7 +674,7 @@ LockToken lockToken = LockToken.parse(lt); NodeImpl node = (NodeImpl) - this.session.getItemManager().getItem(lockToken.getId()); + this.sysSession.getItemManager().getItem(lockToken.getId()); PathMap.Element element = lockMap.map(node.getPrimaryPath(), true); if (element != null) { AbstractLockInfo info = (AbstractLockInfo) element.get(); @@ -698,7 +701,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); } @@ -993,7 +996,7 @@ try { he = new HierarchyEvent(event.getChildId(), - session.getQPath(event.getPath()).getNormalizedPath(), + sysSession.getQPath(event.getPath()).getNormalizedPath(), event.getType()); } catch (MalformedPathException e) { log.info("Unable to get event's path: " + e.getMessage()); @@ -1037,7 +1040,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) { @@ -1177,7 +1180,7 @@ // Use system session present with lock-mgr as fallback // in order to make sure, that session-scoped locks are // properly cleaned. - SessionImpl systemSession = LockManagerImpl.this.session; + SessionImpl systemSession = LockManagerImpl.this.sysSession; setLockHolder(systemSession); try { NodeImpl node = (NodeImpl) systemSession.getItemManager().getItem(getId()); @@ -1222,7 +1225,7 @@ acquire(); try { - Path path = getPath(nodeId); + Path path = getPath(sysSession, nodeId); // create lock token LockInfo info = new LockInfo(new LockToken(nodeId), false, isDeep, lockOwner); @@ -1242,7 +1245,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()); Index: src/test/java/org/apache/jackrabbit/core/XATest.java =================================================================== --- src/test/java/org/apache/jackrabbit/core/XATest.java (revision 772055) +++ src/test/java/org/apache/jackrabbit/core/XATest.java (working copy) @@ -887,7 +887,7 @@ * Test locking a new node inside a transaction. * @throws Exception */ - public void xxxtestLockNewNode() throws Exception { + public void testLockNewNode() throws Exception { // get user transaction object, start UserTransaction utx = new UserTransactionImpl(superuser); utx.begin();