commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CSV-128) Ignore empty column names
Date Wed, 27 Aug 2014 02:29:58 GMT
Gary Gregory created CSV-128:
--------------------------------

             Summary: Ignore empty column 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


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)

Mime
View raw message