[ https://issues.apache.org/jira/browse/LUCENE-9440?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael McCandless updated LUCENE-9440: --------------------------------------- Fix Version/s: 8.7 master (9.0) Resolution: Fixed Status: Resolved (was: Patch Available) Thank you [~sleshJdev]! > FieldInfo#checkConsistency called twice from Lucene50(60)FieldInfosFormat#read > ------------------------------------------------------------------------------ > > Key: LUCENE-9440 > URL: https://issues.apache.org/jira/browse/LUCENE-9440 > Project: Lucene - Core > Issue Type: Improvement > Components: core/index > Affects Versions: master (9.0) > Reporter: Yauheni Putsykovich > Priority: Trivial > Fix For: master (9.0), 8.7 > > Attachments: LUCENE-9440.patch, LUCENE-9440.patch > > > Reviewing code I noticed that we do call _infos[i].checkConsistency();_ > method twice: first time inside the _FiledInfo_'s constructor and a second > one just after we've created an object. > org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java:150 > {code:java} > infos[i] = new FieldInfo(name, fieldNumber, storeTermVector, omitNorms, > storePayloads, indexOptions, docValuesType, dvGen, attributes, 0, 0, 0, > false); > infos[i].checkConsistency(); > {code} > _FileInfo_'s constructor(notice the last line) > {code:java} > public FieldInfo(String name, int number, boolean storeTermVector, boolean > omitNorms, boolean storePayloads, > IndexOptions indexOptions, DocValuesType docValues, long > dvGen, Map<String,String> attributes, > int pointDimensionCount, int pointIndexDimensionCount, int > pointNumBytes, boolean softDeletesField) { > this.name = Objects.requireNonNull(name); > this.number = number; > this.docValuesType = Objects.requireNonNull(docValues, "DocValuesType must > not be null (field: \"" + name + "\")"); > this.indexOptions = Objects.requireNonNull(indexOptions, "IndexOptions must > not be null (field: \"" + name + "\")"); > if (indexOptions != IndexOptions.NONE) { > this.storeTermVector = storeTermVector; > this.storePayloads = storePayloads; > this.omitNorms = omitNorms; > } else { // for non-indexed fields, leave defaults > this.storeTermVector = false; > this.storePayloads = false; > this.omitNorms = false; > } > this.dvGen = dvGen; > this.attributes = Objects.requireNonNull(attributes); > this.pointDimensionCount = pointDimensionCount; > this.pointIndexDimensionCount = pointIndexDimensionCount; > this.pointNumBytes = pointNumBytes; > this.softDeletesField = softDeletesField; > assert checkConsistency(); > } > {code} > > By this patch, I will remove the second call and leave only one in the > constructor. > -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org