[ 
https://issues.apache.org/jira/browse/CSV-164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15021210#comment-15021210
 ] 

Gary Gregory commented on CSV-164:
----------------------------------

I just added this unit test:

{code:java}
    @Test
    public void testSkipHeaderOverrideDuplicateHeaders() throws Exception {
        final Reader in = new StringReader("a,a,a\n1,2,3\nx,y,z");
        final Iterator<CSVRecord> records = CSVFormat.DEFAULT.withHeader("X", 
"Y", "Z").withSkipHeaderRecord()
                .parse(in).iterator();
        final CSVRecord record = records.next();
        assertEquals("1", record.get("X"));
        assertEquals("2", record.get("Y"));
        assertEquals("3", record.get("Z"));
    }
{code}

The input has columns all named {{"a"}}, which are overridden to X, Y and Z. 
Problem solved, yes?

> support duplicate headers
> -------------------------
>
>                 Key: CSV-164
>                 URL: https://issues.apache.org/jira/browse/CSV-164
>             Project: Commons CSV
>          Issue Type: Bug
>            Reporter: Romain Manni-Bucau
>
> nothing prevents a CSV to have the same time the same header name so 
> validation at the end of org.apache.commons.csv.CSVFormat#validate should 
> likely disappear or should support a flag to disable it



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to