[ 
https://issues.apache.org/jira/browse/CSV-247?focusedWorklogId=281159&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-281159
 ]

ASF GitHub Bot logged work on CSV-247:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Jul/19 17:20
            Start Date: 23/Jul/19 17:20
    Worklog Time Spent: 10m 
      Work Description: aherbert commented on issue #47: CSV-247: CSVParser to 
check an empty header before checking duplicates.
URL: https://github.com/apache/commons-csv/pull/47#issuecomment-514304253
 
 
   Hi @mykolapolonskyi .
   
   I do not understand your bug in your demo code. Are you testing that if the 
format has an enumeration of header names and you parse an input that does not 
match the header it should throw an exception?
   
   IIUC the withHeader(Enum) method is used to define an array of headers for 
the format. The parse method will then read records and skip trying to read a 
header because it has one.
   
   I don't think your issue is related to this PR as this addresses code to 
parse the header from the input. With your example you are skipping this code 
as you provide a header. Please ask on the [Commons CSV user mailing 
lists](https://commons.apache.org/proper/commons-csv/mail-lists.html) about 
this. It may be an incorrect use of the functionality or it may be a bug. If so 
it should be addressed in a separate issue.
 
----------------------------------------------------------------
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:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 281159)
    Time Spent: 40m  (was: 0.5h)

> A single empty header is allowed when not allowing empty column headers.
> ------------------------------------------------------------------------
>
>                 Key: CSV-247
>                 URL: https://issues.apache.org/jira/browse/CSV-247
>             Project: Commons CSV
>          Issue Type: Bug
>    Affects Versions: 1.7
>            Reporter: Alex D Herbert
>            Priority: Minor
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> If the settings are not allowing empty columns headers you can currently use 
> a single empty header. This is because column headers are only checked for 
> empty when they are duplicates. So it is the second empty header (the first 
> duplicate) that raises an error. This test should pass but does not:
> {code:java}
> @Test(expected = IllegalArgumentException.class)
> public void testHeadersMissingOneColumnException() throws Exception {
>     final Reader in = new StringReader("a,,c,d\n1,2,3,4\nx,y,z,zz");    
> CSVFormat.DEFAULT.withHeader().parse(in).iterator(); 
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to