commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wren (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CSV-153) CSVPrinter doesn't skip creation of header record if skipHeaderRecord is set to true
Date Thu, 18 Jun 2015 14:09:01 GMT

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

Wren commented on CSV-153:
--------------------------

There is technically a workaround which involves not setting the headers in CSVFormat which
in turn ensures that the header record doesn't show up.
{code}
String[] headers = ...
CSVFormat format = ...
if (!skipHeaderRecord) {
    format.withHeader(headers);
}
CSVPrinter printer = ...
{code}

I think changing CSVPrinter to skip creation of header record is a cleaner solution compared
to the workaround. Any comments?

> CSVPrinter doesn't skip creation of header record if skipHeaderRecord is set to true
> ------------------------------------------------------------------------------------
>
>                 Key: CSV-153
>                 URL: https://issues.apache.org/jira/browse/CSV-153
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Printer
>            Reporter: Wren
>            Priority: Minor
>
> CSVParser uses CSVFormat.getSkipHeaderRecord to initialize index mapping and skip the
first record as well (initializeHeader method). It's inconsistent that CSVPrinter doesn't
skip creation of header record since the skipHeaderRecord boolean should be applicable for
reads/writes.



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

Mime
View raw message