Skip to content

Apache Lucene open-source search software

temporary directory in isLocked(String) was never closed

Christoph Goller8256d94f567c
diff --git a/src/java/org/apache/lucene/index/IndexReader.java b/src/java/org/apache/lucene/index/IndexReader.java
index 8096ff3a4c8..9a50db715b3 100644
--- a/src/java/org/apache/lucene/index/IndexReader.java
+++ b/src/java/org/apache/lucene/index/IndexReader.java
@@ -573,7 +573,10 @@ public abstract class IndexReader {
* @throws IOException if there is a problem with accessing the index
*/
public static boolean isLocked(String directory) throws IOException {
- return isLocked(FSDirectory.getDirectory(directory, false));
+ Directory dir = FSDirectory.getDirectory(directory, false);
+ boolean result = isLocked(dir);
+ dir.close();
+ return result;
}
/**