You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2020/01/02 09:49:06 UTC

[lucene-solr] branch master updated: 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.

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new b1bb7bf  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.
b1bb7bf is described below

commit b1bb7bf8c24eb0a1e6ee87d842711e1d582bade8
Author: Dawid Weiss <dw...@apache.org>
AuthorDate: Thu Jan 2 10:48:10 2020 +0100

    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.
---
 lucene/misc/src/test/org/apache/lucene/document/TestLazyDocument.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 5a2f047..e76491e 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