commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <>
Subject Re: [CSV] Headers and the first record
Date Wed, 31 Jul 2013 13:08:30 GMT
On Tue, Jul 30, 2013 at 5:47 PM, Emmanuel Bourg <> wrote:

> Le 30/07/2013 23:24, Gary Gregory a écrit :
> > Yeah, that's too clever IMO. I expected the same behavior WRT record
> > reading with the only difference being if I let the parser guess or not.
> Too clever? I didn't feel like I designed a rocket with this feature
> though :) That's an important feature to me and I'd like to preserve it.
> If the header is defined in the file I don't want to skip the first
> record manually, the parser should take care of it.

But that is exactly what _was_ happening! ;)

If I called withHeader("A", "B", "C") the header was not skipped.
If I called withHeader(new String[]{}) the header was skipped.
If I called withHeader() the header was skipped (same as line above).

In both cases, I am telling the parser that there is a header, but it is
not skipped in both cases. That's the inconsistency I fixed.

What I am asking is: should we have a saveHeader setting such that IF you
ask for headers, then we save that record in the parser, it is currently
"lost", or, actually transformed into the header map.


> That also means the
> user code can remain the same, whether the header is defined in the code
> or in the file.
> > The current code now always reads the header line if you set any non-null
> > header. If you call withHeader() with no args it is a non-null call with
> an
> > empty String[].
> I guess a null header or an empty header is just the same and means the
> first record must be used as the header.
> Emmanuel Bourg
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

E-Mail: |
Java Persistence with Hibernate, Second Edition<>
JUnit in Action, Second Edition <>
Spring Batch in Action <>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message