[ https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=248005&page=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, Errors: 0, Skipped: 0, Time elapsed: 0.066 s - in org.apache.commons.csv.AssertionsTest [INFO] Running org.apache.commons.csv.CSVFileParserTest [INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.041 s - in org.apache.commons.csv.CSVFileParserTest [INFO] Running org.apache.commons.csv.CSVFormatPredefinedTest [INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in org.apache.commons.csv.CSVFormatPredefinedTest [INFO] Running org.apache.commons.csv.CSVFormatTest [INFO] Tests run: 56, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.074 s - in org.apache.commons.csv.CSVFormatTest [INFO] Running org.apache.commons.csv.CSVParserTest [WARNING] Tests run: 81, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 0.051 s - in org.apache.commons.csv.CSVParserTest [INFO] Running org.apache.commons.csv.CSVPrinterTest \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N [WARNING] Tests run: 99, Failures: 0, Errors: 0, Skipped: 10, Time elapsed: 3.38 s - in org.apache.commons.csv.CSVPrinterTest [INFO] Running org.apache.commons.csv.CSVRecordTest [INFO] Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in org.apache.commons.csv.CSVRecordTest [INFO] Running org.apache.commons.csv.ExtendedBufferedReaderTest [INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 s - in org.apache.commons.csv.ExtendedBufferedReaderTest [INFO] Running org.apache.commons.csv.issues.JiraCsv164Test [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 s - in org.apache.commons.csv.issues.JiraCsv164Test [INFO] Running org.apache.commons.csv.issues.JiraCsv167Test [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 s - in org.apache.commons.csv.issues.JiraCsv167Test [INFO] Running org.apache.commons.csv.issues.JiraCsv198Test [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.212 s - in org.apache.commons.csv.issues.JiraCsv198Test [INFO] Running org.apache.commons.csv.issues.JiraCsv203Test [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in org.apache.commons.csv.issues.JiraCsv203Test [INFO] Running org.apache.commons.csv.issues.JiraCsv213Test [WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.005 s - in org.apache.commons.csv.issues.JiraCsv213Test [INFO] Running org.apache.commons.csv.LexerTest [INFO] Tests run: 26, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 s - in org.apache.commons.csv.LexerTest [INFO] Running org.apache.commons.csv.TokenMatchersTest [INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in org.apache.commons.csv.TokenMatchersTest [INFO] [INFO] Results: [INFO] [WARNING] Tests run: 325, Failures: 0, Errors: 0, Skipped: 15 [INFO] [INFO] [INFO] --- maven-jar-plugin:3.1.1:jar (default-jar) @ commons-csv --- [INFO] Building jar: C:\git\commons-csv\target\commons-csv-1.7-SNAPSHOT.jar [INFO] [INFO] --- maven-site-plugin:3.7.1:attach-descriptor (attach-descriptor) @ commons-csv --- [INFO] Skipping because packaging 'jar' is not pom. [INFO] [INFO] --- maven-jar-plugin:3.1.1:test-jar (default) @ commons-csv --- [INFO] Building jar: C:\git\commons-csv\target\commons-csv-1.7-SNAPSHOT-tests.jar [INFO] [INFO] --- maven-source-plugin:3.0.1:jar-no-fork (create-source-jar) @ commons-csv --- [INFO] Building jar: C:\git\commons-csv\target\commons-csv-1.7-SNAPSHOT-sources.jar [INFO] [INFO] --- maven-source-plugin:3.0.1:test-jar-no-fork (create-source-jar) @ commons-csv --- [INFO] Building jar: C:\git\commons-csv\target\commons-csv-1.7-SNAPSHOT-test-sources.jar [INFO] [INFO] --- jacoco-maven-plugin:0.8.3:check (check) @ commons-csv --- [INFO] Loading execution data file C:\git\commons-csv\target\jacoco.exec [INFO] Analyzed bundle 'commons-csv' with 15 classes [WARNING] Rule violated for bundle commons-csv: classes covered ratio is 0.93, but expected minimum is 1.00 [WARNING] Rule violated for bundle commons-csv: instructions covered ratio is 0.89, but expected minimum is 0.90 [WARNING] Rule violated for bundle commons-csv: methods covered ratio is 0.94, but expected minimum is 0.95 [WARNING] Rule violated for bundle commons-csv: complexity covered ratio is 0.84, but expected minimum is 0.85 [WARNING] Coverage checks have not been met. See log for details. [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ commons-csv --- [INFO] Installing C:\git\commons-csv\target\commons-csv-1.7-SNAPSHOT.jar to C:\Users\ggregory\.m2\repository\org\apache\commons\commons-csv\1.7-SNAPSHOT\commons-csv-1.7-SNAPSHOT.jar [INFO] Installing C:\git\commons-csv\pom.xml to C:\Users\ggregory\.m2\repository\org\apache\commons\commons-csv\1.7-SNAPSHOT\commons-csv-1.7-SNAPSHOT.pom [INFO] Installing C:\git\commons-csv\target\commons-csv-1.7-SNAPSHOT-tests.jar to C:\Users\ggregory\.m2\repository\org\apache\commons\commons-csv\1.7-SNAPSHOT\commons-csv-1.7-SNAPSHOT-tests.jar [INFO] Installing C:\git\commons-csv\target\commons-csv-1.7-SNAPSHOT-sources.jar to C:\Users\ggregory\.m2\repository\org\apache\commons\commons-csv\1.7-SNAPSHOT\commons-csv-1.7-SNAPSHOT-sources.jar [INFO] Installing C:\git\commons-csv\target\commons-csv-1.7-SNAPSHOT-test-sources.jar to C:\Users\ggregory\.m2\repository\org\apache\commons\commons-csv\1.7-SNAPSHOT\commons-csv-1.7-SNAPSHOT-test-sources.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 19.972 s [INFO] Finished at: 2019-05-24T08:21:10-04:00 [INFO] ------------------------------------------------------------------------ ``` ---------------------------------------------------------------- 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: 248005) Time Spent: 2h 20m (was: 2h 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: 2h 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<CSVRecord>, 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<String>` > 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)