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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: Parser
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: