[ 
https://issues.apache.org/jira/browse/CSV-128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14112245#comment-14112245
 ] 

Gary Gregory edited comment on CSV-128 at 8/27/14 2:10 PM:
-----------------------------------------------------------

Ok, so this can be handled with {{withAllowMissingColumnNames(true)}} so the 
bug could be that the built-in {{EXCEL}} format object should have 
{{withAllowMissingColumnNames(true)}}.

How about that?

I have a commit read and I changed the title of this JIRA to reflect the change 
to "CSVFormat.EXCEL should ignore empty header names"


was (Author: garydgregory):
Ok, so this can be handled with {{withAllowMissingColumnNames(true)}} so the 
bug could be that the built-in {{EXCEL}} format object should have 
{{withAllowMissingColumnNames(true)}}.

How about that?

> CSVFormat.EXCEL should ignore empty header names
> ------------------------------------------------
>
>                 Key: CSV-128
>                 URL: https://issues.apache.org/jira/browse/CSV-128
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: 1.0
>         Environment: Apache Maven 3.2.3 
> (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00)
> Maven home: C:\Java\apache-maven-3.2.3
> Java version: 1.7.0_65, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_65\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Gary Gregory
>             Fix For: Patch Needed
>
>
> I have an Excel file with a first row with N column names
> If there are additional columns that are not labeled, Excel exports empty 
> columns. For example:
> A,B,C,,
> a,b,c,d,e
> This causes an IAE like:
> {noformat}
> java.lang.IllegalArgumentException: The header contains a duplicate name: "" 
> in [A, B, C, , ]
>       at org.apache.commons.csv.CSVParser.initializeHeader(CSVParser.java:368)
>       at org.apache.commons.csv.CSVParser.<init>(CSVParser.java:248)
>       at org.apache.commons.csv.CSVParser.parse(CSVParser.java:206)
> {noformat}    
> It seems like the simplest solution is to ignore empty column names, such 
> that they cannot be addressable and not attempt to index them.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to