LUCENE-5611: always call PerField.finish even on non-aborting exc

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1591399 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-04-30 17:12:54 +00:00
parent bc0d7bbb25
commit 0a83273dfa
1 changed files with 15 additions and 17 deletions

View File

@ -23,10 +23,6 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute;
import org.apache.lucene.codecs.DocValuesConsumer;
import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.codecs.FieldInfosWriter;
@ -265,6 +261,7 @@ final class DefaultIndexingChain extends DocConsumer {
termsHash.startDocument();
// Invert indexed fields:
try {
for (IndexableField field : docState.doc.indexableFields()) {
IndexableFieldType fieldType = field.fieldType();
PerField fp = getOrAddField(field.name(), fieldType, true);
@ -276,11 +273,12 @@ final class DefaultIndexingChain extends DocConsumer {
fp.fieldGen = fieldGen;
}
}
} finally {
// Finish each field name seen in the document:
for (int i=0;i<fieldCount;i++) {
fields[i].finish();
}
}
boolean success = false;
try {