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:
Robert Muir 2014-09-14 17:41:51 +00:00
parent 771e1e399e
commit b23b1037a6
1 changed files with 14 additions and 14 deletions

View File

@ -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;
}
}