close the linefiledocs always

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1326473 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-04-16 03:52:31 +00:00
parent 776e1b4a98
commit fffdb569d0
1 changed files with 38 additions and 33 deletions

View File

@ -34,6 +34,7 @@ import java.util.HashMap;
import org.apache.lucene.analysis.tokenattributes.*;
import org.apache.lucene.util.Attribute;
import org.apache.lucene.util.AttributeImpl;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.LineFileDocs;
import org.apache.lucene.util._TestUtil;
@ -455,6 +456,7 @@ public abstract class BaseTokenStreamTestCase extends LuceneTestCase {
final LineFileDocs docs = new LineFileDocs(random);
try {
for (int i = 0; i < iterations; i++) {
String text;
@ -491,6 +493,9 @@ public abstract class BaseTokenStreamTestCase extends LuceneTestCase {
Rethrow.rethrow(t);
}
}
} finally {
IOUtils.closeWhileHandlingException(docs);
}
}
public static String escape(String s) {