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

HeaderMap is inconsistent when it is parsed from an input with duplicate columns names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.0
    • Parser

    Description

      Given a parser format for csv files with a header line:

      CSVFormat myFormat = CSVFormat.RFC4180.withDelimiter(",").withQuoteChar('"').withQuotePolicy(Quote.MINIMAL)
      				.withIgnoreSurroundingSpaces(true).withHeader().withSkipHeaderRecord(true);
      

      And given a file with duplicate header names:

      Col1,Col2,Col2,Col3,Col4
      1,2,3,4,5
      4,5,6,7,8

      The HeaderMap returned by the parser misses an entry because of the Column name being used as a key, leading to wrong behavior when we rely on it.

      If this is not supposed to happen in the file regarding the CSV format, at least this should raise an error. If not we should come up with a more clever way to store and access the headers.

      Attachments

        Issue Links

          Activity

            People

              britter Benedikt Ritter
              rgosse Romain Gossé
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: