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

CSVRecord.toMap() fails if row length shorter than header length

    XMLWordPrintableJSON

Details

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

    Description

      Similar to CSV-96, if .toMap() is called on a record that has fewer fields than we have header columns we'll get an ArrayOutOfBoundsException.

      @Test
      public void testToMapWhenHeaderTooLong() throws Exception {
         final CSVParser parser = new CSVParser("a,b", CSVFormat.newBuilder().withHeader("A", "B", "C").build());
         final CSVRecord record = parser.iterator().next();
         record.toMap();
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            rup Rupert Wood
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: