mirror of https://github.com/apache/lucene.git
LUCENE-5945: fix test bug, ensure 'dir' is always closed
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1624882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
771e1e399e
commit
b23b1037a6
|
@ -159,7 +159,7 @@ public class TestIndexWriterOnJRECrash extends TestNRTThreads {
|
|||
if (exc != null) {
|
||||
throw exc;
|
||||
} else {
|
||||
BaseDirectoryWrapper dir = newFSDirectory(dirPath);
|
||||
try (BaseDirectoryWrapper dir = newFSDirectory(dirPath)) {
|
||||
dir.setCheckIndexOnClose(false); // don't double-checkindex
|
||||
if (DirectoryReader.indexExists(dir)) {
|
||||
if (VERBOSE) {
|
||||
|
@ -172,9 +172,9 @@ public class TestIndexWriterOnJRECrash extends TestNRTThreads {
|
|||
if (SegmentInfos.getLastCommitGeneration(dir) > 1) {
|
||||
TestUtil.checkIndex(dir);
|
||||
}
|
||||
dir.close();
|
||||
found.set(true);
|
||||
}
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue