Thank you for the new tests Alex! Here is one area that is easy to overlook: As Commons CSV has evolved, _not all settings in CSVFormat_ apply to both writing and parsing. To wit, the existing Javadoc for CSVFormat.getAllowMissingColumnNames(): "Gets whether missing column names are allowed when parsing the header line."
I've updated the Javadoc for CSVFormat.Builder.setAllowMissingColumnNames(boolean) to state this is a parser setting. I've also updated the test since the commented-out test data is valid for parsing. In git master now. Gary On 2022/10/22 17:37:15 Alex Herbert wrote: > On Sat, 22 Oct 2022 at 13:56, Gary D. Gregory <ggreg...@apache.org> wrote: > > > > Thank you for your excellent investigation, Alex, and for finding and > > fixing the missing Test annotations. Overall, we have 98% coverage. > > :) > > > Taking stock, I think that this is where we are, we have main 3 issues: > > > > 1) Compatibility of duplicate header behavior from version to version > > 2) Validation bug with empty headers > > 3) Writing and parsing behavior mismatch > > > > One at a time: > > > > 1) Compatibility of duplicate header behavior from version to version > > > > - We have behavior [A] from 1.0 to 1.6. > > - We have behavior [B] from 1.7 to 1.9. > > - We are discussing if 1.10.0 should have behavior [A] or [B] > > > > I would vote for keeping behavior B for simplicity and keeping with the > > principle of least surprise: Maintaining the current behavior is better > > than flip-flopping. > > +1 > > > 2) Validation bug with empty headers > > > > Fixed in git master commit 289ffa16275c518722c6cda913bfca8a6e1a1411; please > > do verify the tests. I've added 3 test methods per Alex's failing examples > > below. > > The fix does not address the allowMissingColumnNames flag. This flag > is not mentioned in the Jira tickets for duplicate column names but it > is used by the CSVParser and changes behaviour. > > I added a new test class that has all the combinations of > DuplicateHeaderMode and allowMissingColumnNames with various headers. > The test has 36 cases and all are passed by the CSVParser. 6 are > currently not passed by CSVFormat and so have been disabled. Please > review git master commit 24ffa7b4cf9cc392c4fd6a70363f103d40d1d1a7. Add > more cases for other headers if required. > > > 3) Writing and parsing behavior mismatch > > > > I've updated the documentation in git master as Alex suggested. > > Thanks. > > Alex > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org