Skip to content

Commit 288a743

Browse files
committed
[bugfix] Avoid NPE when <document use-path-locks=true/> is set in conf.xml
1 parent 9ad24bd commit 288a743

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

exist-core/src/main/java/org/exist/storage/lock/LockManager.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,12 @@ public ManagedDocumentLock acquireDocumentWriteLock(final XmldbURI documentPath)
576576
* @return true if a WRITE_LOCK is held
577577
*/
578578
public boolean isDocumentLockedForWrite(final XmldbURI documentPath) {
579-
final MultiLock existingLock = getDocumentLock(documentPath.toString());
579+
final MultiLock existingLock;
580+
if (!usePathLocksForDocuments) {
581+
existingLock = getDocumentLock(documentPath.toString());
582+
} else {
583+
existingLock = getPathLock(documentPath.toString());
584+
}
580585
return existingLock.getWriteLockCount() > 0;
581586
}
582587

@@ -588,7 +593,12 @@ public boolean isDocumentLockedForWrite(final XmldbURI documentPath) {
588593
* @return true if a READ_LOCK is held
589594
*/
590595
public boolean isDocumentLockedForRead(final XmldbURI documentPath) {
591-
final MultiLock existingLock = getDocumentLock(documentPath.toString());
596+
final MultiLock existingLock;
597+
if (!usePathLocksForDocuments) {
598+
existingLock = getDocumentLock(documentPath.toString());
599+
} else {
600+
existingLock = getPathLock(documentPath.toString());
601+
}
592602
return existingLock.getReadLockCount() > 0;
593603
}
594604

0 commit comments

Comments
 (0)