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
This commit is contained in:
Robert Muir 2013-02-14 12:34:54 +00:00
parent ac51d4f1b0
commit 9797b73c48
1 changed files with 3 additions and 4 deletions

View File

@ -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;
}
}