You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2014/04/22 22:22:17 UTC

[jira] [Resolved] (CSV-111) CSVRecord.toMap() fails if row length shorter than header length

     [ https://issues.apache.org/jira/browse/CSV-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory resolved CSV-111.
------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0

{noformat}
commit -m "[CSV-111] CSVRecord.toMap() fails if row length shorter than header length." C:/vcs/svn/apache/commons/trunks-proper/csv/src/main/java/org/apache/commons/csv/CSVRecord.java C:/vcs/svn/apache/commons/trunks-proper/csv/src/test/java/org/apache/commons/csv/CSVRecordTest.java
    Sending        C:/vcs/svn/apache/commons/trunks-proper/csv/src/main/java/org/apache/commons/csv/CSVRecord.java
    Sending        C:/vcs/svn/apache/commons/trunks-proper/csv/src/test/java/org/apache/commons/csv/CSVRecordTest.java
    Transmitting file data ...
    Committed revision 1589281.
{noformat}

> CSVRecord.toMap() fails if row length shorter than header length
> ----------------------------------------------------------------
>
>                 Key: CSV-111
>                 URL: https://issues.apache.org/jira/browse/CSV-111
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Parser
>            Reporter: Rupert Wood
>             Fix For: 1.0
>
>
> 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.
> {code}
> @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();
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)