-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CSV-239] Add CSVRecord.getHeaderNames and allow duplicate headers #41
Conversation
* getHeaderNames returns all headers in column order including repeats which are allowed as per RFC 4180 * add CSVFormat.withAllowDuplicateHeaderNames()
* only wrap headerNames with unmodifiableList if non-empty * fix and enhance CSVRecord.toMap javadoc
* fix exception messages
* fix whitespace
* simplify if statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* fix indentation * add javadoc to Headers class * rename method to createHeaders * use String.format to build error message * initialize header names List with appropriate size
Thanks for the review, I've addressed all comments with the latest commit. |
BTW @garydgregory , would you like me to fix these
I would just specify the latest versions explicitly for those plugins. |
@davidmoten I do not see these warnings. What command do you run to get these? |
|
Merged. I do not see your warnings. Here is my output:
|
Yeah no problem with the warnings. Not sure how I provoked them! Thanks for the merge. The next obvious question is when will you build a release? |
I do not have hard set plans. Maybe sometimes next week. I have to finish
Commons Configuration 2.5 first...
Gary
…On Sat, May 25, 2019, 01:56 Dave Moten ***@***.***> wrote:
Yeah no problem with the warnings. Not sure how I provoked them! Thanks
for the merge. The next obvious question is when will you build a release?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#41?email_source=notifications&email_token=AAJB6N3OTWRQX3Y5NJS6USDPXDIJLA5CNFSM4HOQDIL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWHECGA#issuecomment-495862040>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJB6N7H3R7UFLGOKNPTQ6TPXDIJLANCNFSM4HOQDILQ>
.
|
Would you mind providing another PR that adds Javadocs to the public methods you added in |
These are the changes:
getHeaderNames
returns all headers in column order including repeats which are allowed in general as per RFC 4180CSVFormat.withAllowDuplicateHeaderNames()
.CSVFormat.DEFAULT
now allows duplicate header names because RFC 4190 allows non-unique header names. This is a behavioural change but not a breaking API change anywhere because there is no API contract for it (e.g. javadoc). BecauseCSVFormat.DEFAULT
should reflect RFC 4190 I'd classify this as a bug fix.CSVFormat
isSerializable
which means adding new fields to it (allowDuplicateHeaderNames
) is theoretically a breaking change. I propose we allow this minor breaking change and also propose thatCSVFormat
does not implementSerializable
in 2.xCSVRecord.toMap
javadocCSVParser
where an IAE is thrown with a message about duplicate headers when the problem was actually a missing header nameQuestion:
Not addressed:
CSVRecord.toMap
returned a Map whose entries are iterable in column order but this involves quite a bit of rework so will leave for another PR (probably for 2.x).CSVRecord.get(String)
should ideally throw when two columns with that header name existNotes for 2.x:
CSVFormat.withAllowMissingColumnNames
should beCSVFormat.withAllowMissingHeaderNames
Serializable
fromCSVFormat
CSVFormat.withIgnoreHeaderCase
creates problems and lacks flexibility. I'd suggestCSVRecord.getIgnoreCase(int)
instead