aherbert opened a new pull request #47: CSV-247: CSVParser to check an empty 
header before checking duplicates.
URL: https://github.com/apache/commons-csv/pull/47
 
 
   This rearranges the logic of checking for empty column headers before 
checking for duplicates.
   
   I've left the rest of the logic alone. The implication is that it will 
always allow a duplicate header if the header is empty irrespective of whether 
duplicates are not allowed. So you can configure the parser to not allow 
duplicates but allow missing headers and then it skips the fact that each 
missing header is a duplicate. If documented this in the code.
   
   I also note that the header is checked for a duplicate without trim but the 
empty header check uses trim. This is contradictory but perhaps a user does 
want to have headers `"A"," A "," A"`. Any proper CSV header would not 
whitespace pad headers so I'll leave this until someone reports it as a 
problem. 
   
   The fix found that the existing test `CSVParserTest.testHeaderMissing()` did 
not set the AllowMissingColumnNames property. If this test is to work with a 
missing header then it needs that setting.
   
   I also updated the tests of missing headers which use 5 columns to have 5 
entries in the record. Previously it was 4 which is not correct.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to