You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2014/08/27 16:11:57 UTC
[jira] [Updated] (CSV-128) CSVFormat.EXCEL should ignore empty
header names
[ https://issues.apache.org/jira/browse/CSV-128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary Gregory updated CSV-128:
-----------------------------
Summary: CSVFormat.EXCEL should ignore empty header names (was: Ignore empty Excel column names)
> 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)