[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-27 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=249050=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-249050
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 27/May/19 22:17
Start Date: 27/May/19 22:17
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on issue #42: [CSV-239] Add 
javadoc to CSVFormat
URL: https://github.com/apache/commons-csv/pull/42#issuecomment-496313946
 
 
   Merged. Thank you!
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 249050)
Time Spent: 3.5h  (was: 3h 20m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
> Fix For: 1.7
>
>  Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-27 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=249049=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-249049
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 27/May/19 22:17
Start Date: 27/May/19 22:17
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #42: [CSV-239] 
Add javadoc to CSVFormat
URL: https://github.com/apache/commons-csv/pull/42
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 249049)
Time Spent: 3h 20m  (was: 3h 10m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
> Fix For: 1.7
>
>  Time Spent: 3h 20m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-27 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=249048=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-249048
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 27/May/19 21:59
Start Date: 27/May/19 21:59
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #42: [CSV-239] Add javadoc 
to CSVFormat
URL: https://github.com/apache/commons-csv/pull/42#issuecomment-496312069
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/23636021/badge)](https://coveralls.io/builds/23636021)
   
   Coverage remained the same at 90.807% when pulling 
**e177f5dc37e737b0fcc1649ab08ac3096a610e0d on davidmoten:add-javadoc** into 
**dca8f17a9755dfb40ed30bc1734e54ba0b04 on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 249048)
Time Spent: 3h 10m  (was: 3h)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
> Fix For: 1.7
>
>  Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-27 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=249047=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-249047
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 27/May/19 21:45
Start Date: 27/May/19 21:45
Worklog Time Spent: 10m 
  Work Description: davidmoten commented on pull request #42: [CSV-239] Add 
javadoc to CSVFormat
URL: https://github.com/apache/commons-csv/pull/42
 
 
   As requested in #41, adds javadoc to new `allowDuplicateHeaderNames` methods,
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 249047)
Time Spent: 3h  (was: 2h 50m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
> Fix For: 1.7
>
>  Time Spent: 3h
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-27 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=248800=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-248800
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 27/May/19 12:12
Start Date: 27/May/19 12:12
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-496192047
 
 
   Would you mind providing another PR that adds Javadocs to the public methods 
you added in `CSVFormat`?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 248800)
Time Spent: 2h 50m  (was: 2h 40m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
> Fix For: 1.7
>
>  Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-25 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=248420=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-248420
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 25/May/19 12:31
Start Date: 25/May/19 12:31
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-495914886
 
 
   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
   > 
,
   > or mute the thread
   > 

   > .
   >
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 248420)
Time Spent: 2h 40m  (was: 2.5h)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
> Fix For: 1.7
>
>  Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-24 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=248396=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-248396
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 25/May/19 05:56
Start Date: 25/May/19 05:56
Worklog Time Spent: 10m 
  Work Description: davidmoten commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-495862040
 
 
   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?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 248396)
Time Spent: 2.5h  (was: 2h 20m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
> Fix For: 1.7
>
>  Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-24 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=248005=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-248005
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 24/May/19 12:22
Start Date: 24/May/19 12:22
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-495601665
 
 
   Merged. I do not see your warnings. Here is my output:
   ```
   C:\git\commons-csv>mvn -V clean install
   Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 
2019-04-04T15:00:29-04:00)
   Maven home: C:\Java\apache-maven-3.6.1\bin\..
   Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: C:\Program 
Files\Java\jdk1.8.0_212\jre
   Default locale: en_US, platform encoding: Cp1252
   OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
   [INFO] Scanning for projects...
   [INFO]
   [INFO] ---< org.apache.commons:commons-csv 
>---
   [INFO] Building Apache Commons CSV 1.7-SNAPSHOT
   [INFO] [ jar 
]-
   [INFO]
   [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ commons-csv ---
   [INFO] Deleting C:\git\commons-csv\target
   [INFO]
   [INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-maven-version) @ 
commons-csv ---
   [INFO]
   [INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-maven-3) @ 
commons-csv ---
   [INFO]
   [INFO] --- apache-rat-plugin:0.13:check (rat-check) @ commons-csv ---
   [INFO] Enabled default license matchers.
   [INFO] Will parse SCM ignores for exclusions...
   [INFO] Parsing exclusions from C:\git\commons-csv\.gitignore
   [INFO] Finished adding exclusions from SCM ignore files.
   [INFO] 70 implicit excludes (use -debug for more details).
   [INFO] 23 explicit excludes (use -debug for more details).
   [INFO] 55 resources included (use -debug for more details)
   [INFO] Rat check: Summary over all files. Unapproved: 0, unknown: 0, 
generated: 0, approved: 48 licenses.
   [INFO]
   [INFO] --- build-helper-maven-plugin:3.0.0:parse-version (parse-version) @ 
commons-csv ---
   [INFO]
   [INFO] --- maven-antrun-plugin:1.8:run (javadoc.resources) @ commons-csv ---
   [INFO] Executing tasks
   
   main:
[copy] Copying 2 files to C:\git\commons-csv\target\apidocs\META-INF
   [INFO] Executed tasks
   [INFO]
   [INFO] --- maven-remote-resources-plugin:1.5:process 
(process-resource-bundles) @ commons-csv ---
   [INFO]
   [INFO] --- buildnumber-maven-plugin:1.4:create (default) @ commons-csv ---
   [INFO] Executing: cmd.exe /X /C "git rev-parse --verify HEAD"
   [INFO] Working directory: C:\git\commons-csv
   [INFO] Storing buildNumber: 030fb8e37c4024b24fac2b5404300449a6741699 at 
timestamp: 1558700454294
   [INFO] Storing buildScmBranch: master
   [INFO]
   [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ 
commons-csv ---
   [INFO] Using 'UTF-8' encoding to copy filtered resources.
   [INFO] skip non existing resourceDirectory 
C:\git\commons-csv\src\main\resources
   [INFO] Copying 2 resources to META-INF
   [INFO]
   [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ 
commons-csv ---
   [INFO] Changes detected - recompiling the module!
   [INFO] Compiling 12 source files to C:\git\commons-csv\target\classes
   [INFO]
   [INFO] --- maven-bundle-plugin:4.1.0:manifest (bundle-manifest) @ 
commons-csv ---
   [INFO]
   [INFO] --- animal-sniffer-maven-plugin:1.17:check (checkAPIcompatibility) @ 
commons-csv ---
   [INFO] Checking unresolved references to 
org.codehaus.mojo.signature:java18:1.0
   [INFO]
   [INFO] --- maven-resources-plugin:3.1.0:testResources 
(default-testResources) @ commons-csv ---
   [INFO] Using 'UTF-8' encoding to copy filtered resources.
   [INFO] Copying 14 resources
   [INFO] Copying 2 resources to META-INF
   [INFO]
   [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ 
commons-csv ---
   [INFO] Changes detected - recompiling the module!
   [INFO] Compiling 19 source files to C:\git\commons-csv\target\test-classes
   [INFO]
   [INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (prepare-agent) @ 
commons-csv ---
   [INFO] argLine set to 
-javaagent:C:\\Users\\ggregory\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.3\\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\\git\\commons-csv\\target\\jacoco.exec
   [INFO]
   [INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ commons-csv ---
   [INFO]
   [INFO] ---
   [INFO]  T E S T S
   [INFO] ---
   [INFO] Running org.apache.commons.csv.AssertionsTest
   [INFO] Tests run: 2, Failures: 0, 

[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-24 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=248003=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-248003
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 24/May/19 12:11
Start Date: 24/May/19 12:11
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #41: [CSV-239] 
Add CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 248003)
Time Spent: 2h 10m  (was: 2h)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-23 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=247672=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-247672
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 23/May/19 20:22
Start Date: 23/May/19 20:22
Worklog Time Spent: 10m 
  Work Description: davidmoten commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-495370938
 
 
   `mvn clean install`. Warnings appear at start of any mvn call actually. 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 247672)
Time Spent: 2h  (was: 1h 50m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 2h
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-23 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=247430=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-247430
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 23/May/19 14:28
Start Date: 23/May/19 14:28
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-495242855
 
 
   @davidmoten I do not see these warnings. What command do you run to get 
these?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 247430)
Time Spent: 1h 50m  (was: 1h 40m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=247283=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-247283
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 23/May/19 05:02
Start Date: 23/May/19 05:02
Worklog Time Spent: 10m 
  Work Description: davidmoten commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-495068088
 
 
   BTW @garydgregory , would you like me to fix these `mvn` warnings while I'm 
here:
   ```
   [WARNING] 'build.plugins.plugin.version' for 
org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 164, column 15
   [WARNING] 'build.plugins.plugin.version' for 
org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 182, column 15
   [WARNING] 'build.plugins.plugin.version' for 
org.apache.rat:apache-rat-plugin is missing. @ line 204, column 15
   ```
   I would just specify the latest versions explicitly for those plugins.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 247283)
Time Spent: 1h 40m  (was: 1.5h)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=247130=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-247130
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 22:58
Start Date: 22/May/19 22:58
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-494627156
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/23552389/badge)](https://coveralls.io/builds/23552389)
   
   Coverage increased (+0.05%) to 90.807% when pulling 
**2a5ddb72aeec50180de878386b4be04a6f41c49c on davidmoten:headers** into 
**4d2616b7a550c2ce855b612829eb34dea9ce09dc on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 247130)
Time Spent: 1.5h  (was: 1h 20m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=247079=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-247079
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 22:01
Start Date: 22/May/19 22:01
Worklog Time Spent: 10m 
  Work Description: davidmoten commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-494990577
 
 
   Thanks for the review, I've addressed all comments with the latest commit.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 247079)
Time Spent: 1h 20m  (was: 1h 10m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=247077=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-247077
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 21:57
Start Date: 22/May/19 21:57
Worklog Time Spent: 10m 
  Work Description: davidmoten commented on pull request #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#discussion_r286704457
 
 

 ##
 File path: src/test/java/org/apache/commons/csv/CSVParserTest.java
 ##
 @@ -1151,6 +1166,14 @@ public void testTrim() throws Exception {
 assertEquals("3", record.get("Z"));
 Assert.assertEquals(3, record.size());
 }
+
+@Test
+public void testRepeatedHeadersAreReturnedInCSVRecordHeaderNames() throws 
IOException {
+final Reader in = new 
StringReader("header1,header2,header1\n1,2,3\n4,5,6");
+final Iterator records = 
CSVFormat.DEFAULT.withFirstRecordAsHeader().withTrim().parse(in).iterator();
+final CSVRecord record = records.next();
+assertEquals(Arrays.asList("header1", "header2", "header1"), 
record.getParser().getHeaderNames());
+}
 
 Review comment:
   Yes, when I added the tests I made sure that coverage was 100% of 
`createHeaders`. That's no guarantee that all cases are covered of course but I 
think we are ok.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 247077)
Time Spent: 1h 10m  (was: 1h)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=246686=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-246686
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 11:59
Start Date: 22/May/19 11:59
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #41: [CSV-239] 
Add CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#discussion_r286450224
 
 

 ##
 File path: src/main/java/org/apache/commons/csv/CSVFormat.java
 ##
 @@ -2233,6 +2254,22 @@ public CSVFormat withTrim() {
 public CSVFormat withTrim(final boolean trim) {
 return new CSVFormat(delimiter, quoteCharacter, quoteMode, 
commentMarker, escapeCharacter,
 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, 
nullString, headerComments, header,
-skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, 
trim, trailingDelimiter, autoFlush);
+skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, 
trim, trailingDelimiter, autoFlush,
+allowDuplicateHeaderNames);
 }
+
+public CSVFormat withAllowDuplicateHeaderNames(boolean 
allowDuplicateHeaderNames) {
+   return new CSVFormat(delimiter, quoteCharacter, quoteMode, 
commentMarker, escapeCharacter,
+ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, 
nullString, headerComments, header,
+skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, 
trim, trailingDelimiter, autoFlush,
+allowDuplicateHeaderNames);
+}
+
+public CSVFormat withAllowDuplicateHeaderNames() {
+   return withAllowDuplicateHeaderNames(true);
+}
+
+   public boolean getAllowDuplicateHeaderNames() {
 
 Review comment:
   Indentation is slightly off on this method.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 246686)
Time Spent: 0.5h  (was: 20m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=246689=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-246689
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 11:59
Start Date: 22/May/19 11:59
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #41: [CSV-239] 
Add CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#discussion_r286451172
 
 

 ##
 File path: src/main/java/org/apache/commons/csv/CSVParser.java
 ##
 @@ -476,27 +488,33 @@ public void close() throws IOException {
 final String header = headerRecord[i];
 final boolean containsHeader = header == null ? false : 
hdrMap.containsKey(header);
 final boolean emptyHeader = header == null || 
header.trim().isEmpty();
-if (containsHeader && (!emptyHeader || 
!this.format.getAllowMissingColumnNames())) {
-throw new IllegalArgumentException("The header 
contains a duplicate name: \"" + header
-+ "\" in " + Arrays.toString(headerRecord));
+if (containsHeader) {
+if (!emptyHeader && 
!this.format.getAllowDuplicateHeaderNames()) {
+throw new IllegalArgumentException("The header 
contains a duplicate name: \"" + header
 
 Review comment:
   I think we should switch to using String.format() here, it would be less 
messy IMO.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 246689)
Time Spent: 50m  (was: 40m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=246688=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-246688
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 11:59
Start Date: 22/May/19 11:59
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #41: [CSV-239] 
Add CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#discussion_r286450889
 
 

 ##
 File path: src/main/java/org/apache/commons/csv/CSVParser.java
 ##
 @@ -445,14 +446,25 @@ public void close() throws IOException {
 new LinkedHashMap<>();
 }
 
+private static final class Headers {
+final Map headerMap;
+final List headerNames;
+
+Headers(Map headerMap, List headerNames) {
+this.headerMap = headerMap;
+this.headerNames = headerNames;
+}
+}
+
 /**
  * Creates the name to index mapping if the format defines a header.
  *
  * @return null if the format has no header.
  * @throws IOException if there is a problem reading the header or 
skipping the first record
  */
-private Map createHeaderMap() throws IOException {
+private Headers createHeaderMapAndHeaderNames() throws IOException {
 
 Review comment:
   I would rename createHeaderMapAndHeaderNames() to createHeaders() to match 
the class name.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 246688)
Time Spent: 40m  (was: 0.5h)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=246691=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-246691
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 11:59
Start Date: 22/May/19 11:59
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #41: [CSV-239] 
Add CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#discussion_r286451896
 
 

 ##
 File path: src/test/java/org/apache/commons/csv/CSVParserTest.java
 ##
 @@ -1151,6 +1166,14 @@ public void testTrim() throws Exception {
 assertEquals("3", record.get("Z"));
 Assert.assertEquals(3, record.size());
 }
+
+@Test
+public void testRepeatedHeadersAreReturnedInCSVRecordHeaderNames() throws 
IOException {
+final Reader in = new 
StringReader("header1,header2,header1\n1,2,3\n4,5,6");
+final Iterator records = 
CSVFormat.DEFAULT.withFirstRecordAsHeader().withTrim().parse(in).iterator();
+final CSVRecord record = records.next();
+assertEquals(Arrays.asList("header1", "header2", "header1"), 
record.getParser().getHeaderNames());
+}
 
 Review comment:
   Thank you for adding tests. Are we sure all cases are covered. You can build 
the site locally and look at he code coverage report.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 246691)
Time Spent: 1h  (was: 50m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=246687=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-246687
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 11:59
Start Date: 22/May/19 11:59
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #41: [CSV-239] 
Add CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#discussion_r286450627
 
 

 ##
 File path: src/main/java/org/apache/commons/csv/CSVParser.java
 ##
 @@ -445,14 +446,25 @@ public void close() throws IOException {
 new LinkedHashMap<>();
 }
 
+private static final class Headers {
 
 Review comment:
   May you please add a tiny Javadoc for this class?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 246687)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-22 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=246690=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-246690
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 11:59
Start Date: 22/May/19 11:59
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #41: [CSV-239] 
Add CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#discussion_r286451512
 
 

 ##
 File path: src/main/java/org/apache/commons/csv/CSVParser.java
 ##
 @@ -476,27 +488,33 @@ public void close() throws IOException {
 final String header = headerRecord[i];
 final boolean containsHeader = header == null ? false : 
hdrMap.containsKey(header);
 final boolean emptyHeader = header == null || 
header.trim().isEmpty();
-if (containsHeader && (!emptyHeader || 
!this.format.getAllowMissingColumnNames())) {
-throw new IllegalArgumentException("The header 
contains a duplicate name: \"" + header
-+ "\" in " + Arrays.toString(headerRecord));
+if (containsHeader) {
+if (!emptyHeader && 
!this.format.getAllowDuplicateHeaderNames()) {
+throw new IllegalArgumentException("The header 
contains a duplicate name: \"" + header
++ "\" in " + Arrays.toString(headerRecord)
++ ". If this is valid then use 
CSVFormat.withAllowDuplicateHeaderNames().");
+}
+if (emptyHeader && 
!this.format.getAllowMissingColumnNames()) {
+throw new IllegalArgumentException(
+"A header name is missing in " + 
Arrays.toString(headerRecord));
+}
 }
 if (header != null) {
 hdrMap.put(header, Integer.valueOf(i));
+if (headerNames == null) {
+   headerNames = new ArrayList<>();
 
 Review comment:
   Can we pass in a reasonable size here?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 246690)
Time Spent: 50m  (was: 40m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-21 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=246536=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-246536
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 02:24
Start Date: 22/May/19 02:24
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41#issuecomment-494627156
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/23530497/badge)](https://coveralls.io/builds/23530497)
   
   Coverage increased (+0.04%) to 90.798% when pulling 
**f7ce79580eb440b91272116eb609bfd019fa6ee1 on davidmoten:headers** into 
**4d2616b7a550c2ce855b612829eb34dea9ce09dc on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 246536)
Time Spent: 20m  (was: 10m)

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Work logged] (CSV-239) Cannot get headers in column order from CSVRecord

2019-05-21 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=246534=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-246534
 ]

ASF GitHub Bot logged work on CSV-239:
--

Author: ASF GitHub Bot
Created on: 22/May/19 02:20
Start Date: 22/May/19 02:20
Worklog Time Spent: 10m 
  Work Description: davidmoten commented on pull request #41: [CSV-239] Add 
CSVRecord.getHeaderNames and allow duplicate headers
URL: https://github.com/apache/commons-csv/pull/41
 
 
   These are the changes:
   
   * add `getHeaderNames` returns all headers in column order including repeats 
which are allowed in general as per RFC 4180
   * add `CSVFormat.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). Because `CSVFormat.DEFAULT` 
should reflect RFC 4190 I'd classify this as a bug fix.
   * `CSVFormat` is `Serializable` which means adding new fields to it 
(`allowDuplicateHeaderNames`) is theoretically a breaking change. I propose we 
allow this minor breaking change and also propose that `CSVFormat` does not 
implement `Serializable` in 2.x
   * fix `CSVRecord.toMap` javadoc
   * fix bug in `CSVParser` where an IAE is thrown with a message about 
duplicate headers when the problem was actually a missing header name
   * add test coverage 
   
   Question:
   * do we need to talk about HeaderNames when we could just say Header?
   
   Not addressed:
   * would be nice if `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 exist
   
   Notes for 2.x: 
   * for consistency `CSVFormat.withAllowMissingColumnNames` should be 
`CSVFormat.withAllowMissingHeaderNames`
   * remove `Serializable` from `CSVFormat`
   * `CSVFormat.withIgnoreHeaderCase` creates problems and lacks flexibility. 
I'd suggest `CSVRecord.getIgnoreCase(int)` instead
   
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 246534)
Time Spent: 10m
Remaining Estimate: 0h

> Cannot get headers in column order from CSVRecord
> -
>
> Key: CSV-239
> URL: https://issues.apache.org/jira/browse/CSV-239
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.6
>Reporter: Dave Moten
>Priority: Minor
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)