Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Move newDirectory() creation to before, otherwise if something happens prior to before/after rule being invoked, the directory wouldn't be closed/ cleaned up properly.

Dawid Weiss128fd9a4ff9c
diff --git a/lucene/misc/src/test/org/apache/lucene/document/TestLazyDocument.java b/lucene/misc/src/test/org/apache/lucene/document/TestLazyDocument.java
index 5a2f047eca3..e76491e79d2 100644
--- a/lucene/misc/src/test/org/apache/lucene/document/TestLazyDocument.java
+++ b/lucene/misc/src/test/org/apache/lucene/document/TestLazyDocument.java
@@ -39,7 +39,7 @@ public class TestLazyDocument extends LuceneTestCase {
{ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k" };
public final int NUM_VALUES = atLeast(100);
- public Directory dir = newDirectory();
+ public Directory dir;
@After
public void removeIndex() {
@@ -53,6 +53,7 @@ public class TestLazyDocument extends LuceneTestCase {
@Before
public void createIndex() throws Exception {
+ dir = newDirectory();
Analyzer analyzer = new MockAnalyzer(random());
IndexWriter writer = new IndexWriter