[ 
https://issues.apache.org/jira/browse/CSV-128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory resolved CSV-128.
------------------------------

    Resolution: Fixed
      Assignee: Gary Gregory

{noformat}
commit -m "[CSV-128] CSVFormat.EXCEL should ignore empty header names" 
C:/vcs/svn/apache/commons/trunks-proper/csv/src/test/java/org/apache/commons/csv/CSVParserTest.java
 
C:/vcs/svn/apache/commons/trunks-proper/csv/src/main/java/org/apache/commons/csv/CSVFormat.java
 C:/vcs/svn/apache/commons/trunks-proper/csv/src/changes/changes.xml
    Sending        
C:/vcs/svn/apache/commons/trunks-proper/csv/src/changes/changes.xml
    Sending        
C:/vcs/svn/apache/commons/trunks-proper/csv/src/main/java/org/apache/commons/csv/CSVFormat.java
    Sending        
C:/vcs/svn/apache/commons/trunks-proper/csv/src/test/java/org/apache/commons/csv/CSVParserTest.java
    Transmitting file data ...
    Committed revision 1620902.
{noformat}

> 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
>            Assignee: 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