From 2b071864927fc10f4e8eb0e6bf0c500c357eab0d Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 16 Apr 2012 04:01:35 +0000 Subject: [PATCH] fix more linefiledocs leaks git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1326474 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java | 2 ++ .../core/src/test/org/apache/lucene/index/TestCustomNorms.java | 2 ++ .../src/test/org/apache/lucene/index/TestDuelingCodecs.java | 2 ++ .../src/test/org/apache/lucene/index/TestForceMergeForever.java | 1 + lucene/core/src/test/org/apache/lucene/index/TestNorms.java | 1 + lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java | 1 + .../test/org/apache/lucene/store/TestNRTCachingDirectory.java | 1 + 7 files changed, 10 insertions(+) diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java index cc12dee7dfb..ff6ac7d0ce3 100644 --- a/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java +++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java @@ -173,6 +173,8 @@ public class TestReuseDocsEnum extends LuceneTestCase { for (int i = 0; i < numdocs; i++) { writer.addDocument(lineFileDocs.nextDoc()); } + + lineFileDocs.close(); } } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java b/lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java index 715e1f9a32d..d89ac5c2092 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java @@ -92,6 +92,7 @@ public class TestCustomNorms extends LuceneTestCase { } open.close(); dir.close(); + docs.close(); } public void testExceptionOnRandomType() throws IOException { @@ -126,6 +127,7 @@ public class TestCustomNorms extends LuceneTestCase { writer.commit(); writer.close(); dir.close(); + docs.close(); } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java b/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java index bbf90e3952a..b667b78853e 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java @@ -129,6 +129,8 @@ public class TestDuelingCodecs extends LuceneTestCase { for (int i = 0; i < numdocs; i++) { writer.addDocument(lineFileDocs.nextDoc()); } + + lineFileDocs.close(); } /** diff --git a/lucene/core/src/test/org/apache/lucene/index/TestForceMergeForever.java b/lucene/core/src/test/org/apache/lucene/index/TestForceMergeForever.java index 3d9bb351c69..80456ea74b5 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestForceMergeForever.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestForceMergeForever.java @@ -100,5 +100,6 @@ public class TestForceMergeForever extends LuceneTestCase { assertTrue("merge count is " + w.mergeCount.get(), w.mergeCount.get() <= 1); w.close(); d.close(); + docs.close(); } } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestNorms.java b/lucene/core/src/test/org/apache/lucene/index/TestNorms.java index bc870fb6480..33228aa8d08 100755 --- a/lucene/core/src/test/org/apache/lucene/index/TestNorms.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestNorms.java @@ -197,6 +197,7 @@ public class TestNorms extends LuceneTestCase { } writer.commit(); writer.close(); + docs.close(); } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java b/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java index ae055e336e5..0eb8f80bd8d 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java @@ -153,6 +153,7 @@ public class TestTermsEnum extends LuceneTestCase { r.close(); d.close(); + docs.close(); } private void addDoc(RandomIndexWriter w, Collection terms, Map termToID, int id) throws IOException { diff --git a/lucene/core/src/test/org/apache/lucene/store/TestNRTCachingDirectory.java b/lucene/core/src/test/org/apache/lucene/store/TestNRTCachingDirectory.java index 9a84380c6e4..d2c7c3480f4 100644 --- a/lucene/core/src/test/org/apache/lucene/store/TestNRTCachingDirectory.java +++ b/lucene/core/src/test/org/apache/lucene/store/TestNRTCachingDirectory.java @@ -100,6 +100,7 @@ public class TestNRTCachingDirectory extends LuceneTestCase { } r.close(); cachedDir.close(); + docs.close(); } // NOTE: not a test; just here to make sure the code frag