fix false test failure

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1101572 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2011-05-10 18:02:06 +00:00
parent a7418eb206
commit 673cef5639
1 changed files with 12 additions and 8 deletions

View File

@ -18,7 +18,6 @@ package org.apache.lucene.index;
*/ */
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.io.Reader; import java.io.Reader;
@ -1130,10 +1129,12 @@ public class TestIndexWriter extends LuceneTestCase {
while(true) { while(true) {
MergePolicy.OneMerge merge = writer.getNextMerge(); MergePolicy.OneMerge merge = writer.getNextMerge();
if (merge == null) if (merge == null) {
break; break;
for(int i=0;i<merge.segments.size();i++) }
assert merge.segments.info(i).docCount < 20; for(int i=0;i<merge.segments.size();i++) {
assert merge.segments.get(i).docCount < 20;
}
writer.merge(merge); writer.merge(merge);
} }
} }
@ -2141,6 +2142,7 @@ public class TestIndexWriter extends LuceneTestCase {
while(true) { while(true) {
if (w != null) { if (w != null) {
w.close(); w.close();
w = null;
} }
IndexWriterConfig conf = newIndexWriterConfig( IndexWriterConfig conf = newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2); TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2);
@ -2186,10 +2188,12 @@ public class TestIndexWriter extends LuceneTestCase {
if (!failed) { if (!failed) {
// clear interrupt state: // clear interrupt state:
Thread.interrupted(); Thread.interrupted();
try { if (w != null) {
w.rollback(); try {
} catch (IOException ioe) { w.rollback();
throw new RuntimeException(ioe); } catch (IOException ioe) {
throw new RuntimeException(ioe);
}
} }
try { try {