Unfortunately, this is wrongly implemented (HeaderNameBaseMappingStrategy:78): if (!this.headerIndex.isEmpty() && numberOfFields != this.headerIndex.getHeaderIndexLength() && !this.forceCorrectRecordLength) { throw new CsvRequiredFieldEmptyException(this.type, ResourceBundle.getBundle("opencsv", this.errorLocale).getString("header.data.mismatch")); } meaning that the Exception gets thrown if forceCorrectRecordLength is false. So in order to avoid the exception, one has to set the field to true.
Unfortunately, this is wrongly implemented (HeaderNameBaseMappingStrategy:78): if (!this.headerIndex.isEmpty() && numberOfFields != this.headerIndex.getHeaderIndexLength() && !this.forceCorrectRecordLength) { throw new CsvRequiredFieldEmptyException(this.type, ResourceBundle.getBundle("opencsv", this.errorLocale).getString("header.data.mismatch")); } meaning that the Exception gets thrown if forceCorrectRecordLength is false. So in order to avoid the exception, one has to set the field to true.
Unfortunately, this is wrongly implemented (HeaderNameBaseMappingStrategy:78): if (!this.headerIndex.isEmpty() && numberOfFields != this.headerIndex.getHeaderIndexLength() && !this.forceCorrectRecordLength) { throw new CsvRequiredFieldEmptyException(this.type, ResourceBundle.getBundle("opencsv", this.errorLocale).getString("header.data.mismatch")); } meaning that the Exception gets thrown if forceCorrectRecordLength is false. So in order to avoid the exception, one has to set the field to true.