mirror of https://github.com/apache/lucene.git
use try-w-resources so Directory is closed even on assumption violation
This commit is contained in:
parent
0e9307bb84
commit
7ff31daeb0
|
@ -34,7 +34,7 @@ public abstract class BaseMergePolicyTestCase extends LuceneTestCase {
|
|||
protected abstract MergePolicy mergePolicy();
|
||||
|
||||
public void testForceMergeNotNeeded() throws IOException {
|
||||
Directory dir = newDirectory();
|
||||
try (Directory dir = newDirectory()) {
|
||||
final AtomicBoolean mayMerge = new AtomicBoolean(true);
|
||||
final MergeScheduler mergeScheduler = new SerialMergeScheduler() {
|
||||
@Override
|
||||
|
@ -78,7 +78,7 @@ public abstract class BaseMergePolicyTestCase extends LuceneTestCase {
|
|||
writer.forceMerge(maxNumSegments);
|
||||
}
|
||||
writer.close();
|
||||
dir.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue