From 9797b73c48bbc979dff0ca529b2089164916596b Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 14 Feb 2013 12:34:54 +0000 Subject: [PATCH] don't assert in close(), check docCount in finish() git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1446144 13f79535-47bb-0310-9956-ffa450edef68 --- .../codecs/asserting/AssertingTermVectorsFormat.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingTermVectorsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingTermVectorsFormat.java index 257dee17ae2..7bdf85b7194 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingTermVectorsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingTermVectorsFormat.java @@ -80,7 +80,7 @@ public class AssertingTermVectorsFormat extends TermVectorsFormat { static class AssertingTermVectorsWriter extends TermVectorsWriter { private final TermVectorsWriter in; private Status docStatus, fieldStatus, termStatus; - private int fieldCount, termCount, positionCount; + private int docCount, fieldCount, termCount, positionCount; boolean hasPositions; AssertingTermVectorsWriter(TermVectorsWriter in) { @@ -98,6 +98,7 @@ public class AssertingTermVectorsFormat extends TermVectorsFormat { in.startDocument(numVectorFields); docStatus = Status.STARTED; fieldCount = numVectorFields; + docCount++; } @Override @@ -167,6 +168,7 @@ public class AssertingTermVectorsFormat extends TermVectorsFormat { @Override public void finish(FieldInfos fis, int numDocs) throws IOException { + assert docCount == numDocs; assert docStatus == (numDocs > 0 ? Status.FINISHED : Status.UNDEFINED); assert fieldStatus != Status.STARTED; assert termStatus != Status.STARTED; @@ -181,9 +183,6 @@ public class AssertingTermVectorsFormat extends TermVectorsFormat { @Override public void close() throws IOException { in.close(); - assert docStatus != Status.STARTED; - assert fieldStatus != Status.STARTED; - assert termStatus != Status.STARTED; } }