Uploaded image for project: 'Commons CSV'
  1. Commons CSV
  2. CSV-128

CSVFormat.EXCEL should ignore empty header names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1
    • Parser
    • None

    Description

      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:

      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)
      

      It seems like the simplest solution is to ignore empty column names, such that they cannot be addressable and not attempt to index them.

      Attachments

        Activity

          People

            ggregory Gary D. Gregory
            ggregory Gary D. Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: