Apache Commons CSV Release Notes [test] Bump com.opencsv:opencsv from 5.11.2 to 5.12.0 #558. CSVPrinter.printRecord(Stream) hangs if given a parallel stream. CSVPrinter now uses an internal lock instead of synchronized methods. org.apache.commons.csv.CSVPrinter.printRecords(ResultSet) now writes one record at a time using a lock. Bump org.apache.commons:commons-parent from 81 to 85 #542. Bump commons-io:commons-io from 2.18.0 to 2.20.0. Bump com.opencsv:opencsv from 5.10 to 5.11.2 #545, #551, #553. Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0 #556. Bump commons-codec:commons-codec from 1.18.0 to 1.19.0. Release history link changed from changes-report.html to changes.html #516. Remove -nouses directive from maven-bundle-plugin. OSGi package imports now state 'uses' definitions for package imports, this doesn't affect JPMS (from org.apache.commons:commons-parent:80). CSVParser.parse(URL, Charset, CSVFormat) with a null CSVFormat maps to CSVFormat.DEFAULT (like CSVParser.parse(Reader, CSVFormat)). CSVParser.parse(String, CSVFormat) with a null CSVFormat maps to CSVFormat.DEFAULT (like CSVParser.parse(Reader, CSVFormat)). CSVParser.parse(File, Charset, CSVFormat) with a null CSVFormat maps to CSVFormat.DEFAULT (like CSVParser.parse(Reader, CSVFormat)). CSVParser.parse(Path, Charset, CSVFormat) with a null CSVFormat maps to CSVFormat.DEFAULT (like CSVParser.parse(Reader, CSVFormat)). CSVParser.parse(InputStream, Charset, CSVFormat) with a null CSVFormat maps to CSVFormat.DEFAULT (like CSVParser.parse(Reader, CSVFormat)). CSVParser.parse(*) methods with a null Charset maps to Charset.defaultCharset(). Fix possible NullPointerException in Token.toString(). Define and use Maven property commons.jmh.version. Add CSVFormat.Builder.setMaxRows(long). Add CSVFormat.getMaxRows(). CSVPrinter.printRecords(ResultSet) knows how to use CSVFormat's maxRows. CSVPrinter.printRecords(Iterable) knows how to use CSVFormat's maxRows. CSVPrinter.printRecords(Stream) knows how to use CSVFormat's maxRows. CSVParser.stream() knows how to use CSVFormat's maxRows. CSVParser.getRecords() knows how to use CSVFormat's maxRows. CSVParser.iterator() knows how to use CSVFormat's maxRows. Bump com.opencsv:opencsv from 5.9 to 5.10. Bump commons-codec:commons-codec from 1.17.2 to 1.18.0 #522. Bump org.apache.commons:commons-parent from 79 to 81. Required OSGi Import-Package version numbers in MANIFEST.MF #504. CSVParser.nextRecord() should throw CSVException (an IOException subclass) instead of IOException and IllegalStateException, no method signature changes needed. Add CSVPrinter.getRecordCount(). Add and use CSVParser.Builder and builder() and deprecate CSVParser constructors. CSVFormat.Builder implements Supplier<CSVFormat>. Deprecate CSVFormat.Builder.build() for get(). Track byte position #502. Bump org.apache.commons:commons-parent from 76 to 78 #486, #495. Bump org.codehaus.mojo:taglist-maven-plugin from 3.1.0 to 3.2.1 #493. Bump commons-io:commons-io from 2.17.0 to 2.18.0 #505. Bump commons-codec:commons-codec from 1.17.1 to 1.17.2. Bump org.apache.commons:commons-parent from 78 to 79. Add CSVException that extends IOException thrown on invalid input instead of IOException. Fix PMD issues for port to PMD 7.1.0. Fix some Javadoc links #442. Extract duplicated code into a method #444. Migrate CSVFormat#print(File, Charset) to NIO #445. Fix documentation for CSVFormat private constructor #466. CSVFormat does not support explicit " as escape char. Escaping is not disableable. Fix Javadoc warnings on Java 23. Improve parser performance by up to 20%, YMMV. Bump commons-codec:commons-codec from 1.16.1 to 1.17.1 #422, #449. Bump org.apache.commons:commons-parent from 69 to 76 #435, #452, #465, #468, #475, #482. Bump org.codehaus.mojo:taglist-maven-plugin from 3.0.0 to 3.1.0 #441. Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #450, #459, #470. Bump org.hamcrest:hamcrest from 2.2 to 3.0 #455. Bump commons-io:commons-io from 2.16.1 to 2.17.0 #476. [Javadoc] Add example to CSVFormat#setHeaderComments() #344. Add and use CSVFormat#setTrailingData(boolean) in CSVFormat.EXCEL for Excel compatibility #303. Add and use CSVFormat#setLenientEof(boolean) in CSVFormat.EXCEL for Excel compatibility #303. Replace deprecated method in user guide, update external link #324, #325. Document duplicate header behavior #309. Add missing docs #328. [StepSecurity] CI: Harden GitHub Actions #329, #330. Better error message during faulty CSV record read #347. Misleading error message when QuoteMode set to None #352. OutOfMemory for very long rows despite using column value of type Reader. Use try-with-resources to manage JDBC CLOB in CSVPrinter.printRecords(ResultSet). JDBC Blob columns are now output as Base64 instead of Object#toString(), which usually is InputStream#toString(). Support unusual Excel use cases: Add support for trailing data after the closing quote, and EOF without a final closing quote #303. MongoDB CSV empty first column parsing fix #412. Bump commons-io:commons-io: from 2.11.0 to 2.16.1 #408, #413. Bump commons-parent from 57 to 69 #410. Bump h2 from 2.1.214 to 2.2.224 #333, #349, #359. Bump commons-lang3 from 3.12.0 to 3.14.0. Update exception message in CSVRecord#getNextRecord() #348. Bump tests using com.opencsv:opencsv from 5.8 to 5.9 #373. Minor changes #172. No Automatic-Module-Name prevents usage in JPMS projects without repacking the JAR. Fix for multi-char delimiter not working as expected #218. CSVRecord.get(Enum) should use Enum.name() instead of Enum.toString(). Allow org.apache.commons.csv.IOUtils.copy(Reader, Appendable, CharBuffer) to compile on Java 11 and run on Java 8. CSVRecord.toList() does not give write access to the new List. CSVParser.getRecords() now throws UncheckedIOException instead of IOException. Add comments to iterator() and stream() #270. Fix wrong assumptions in PostgreSQL formats #265. Validate input to setDelimiter(String) for empty string #266. Bump CSVFormat#serialVersionUID from 1 to 2. CSVParser: Identify duplicates in null, empty and blank header names #279. Serialization in CSVFormat is not supported from one version to the next. Make CSVRecord#values() public. Add DuplicateHeaderMode for flexibility with header strictness. #114. Support for parallelism in CSVPrinter. Add CSVPrinter.printRecord[s](Stream). Add accessors for header/trailer comments #257. Add github/codeql-action. Bump actions/cache from 2.1.6 to 3.0.10 #196, #233, #243, #267, #271. Bump actions/checkout from 2.3.4 to 3.1.0 #188, #195, #220, #272. Bump actions/setup-java from 2 to 3.5.1. Bump actions/upload-artifact from 3.1.0 to 3.1.1 #280. Bump commons-parent from 52 to 57 #264, #288, #298, #323. Bump checkstyle from 8.44 to 9.2.1 #180, #190, #194, #202, #207. Bump junit-jupiter from 5.8.0-M1 to 5.9.1 #179, #186, #201, #244, #263. Bump jmh-core from 1.32 to 1.36 #176, #208, #229, #285. Bump jmh-generator-annprocess from 1.32 to 1.36 #175, #206, #226, #283. Bump mockito-core from 3.11.2 to 4.11.0 #187, #197, #204, #212, #230, #237, #251, #259, #284, #292, #297. Bump maven-pmd-plugin from 3.14.0 to 3.19.0 #184, #219, #238, #254, #258. Bump pmd from 6.36.0 to 6.52.0 #173, #189, #193, #199, #227, #233, #214, #236, #240, #247, #255, #273. Bump opencsv from 5.5.1 to 5.7.1 #182, #221, #260, #281. Bump spotbugs-maven-plugin from 4.3.0 to 4.7.3.0 #192, #198, #203, #211, #225, #234, #242, #245, #261, #275, #282. Bump com.github.spotbugs:spotbugs from 4.5.3 to 4.7.2. Bump h2 from 1.4.200 to 2.1.214 #200, #205, #213, #239. Bump maven-javadoc-plugin from 3.3.0 to 3.4.1. Bump biz.aQute.bnd:biz.aQute.bndlib from 5.3.0 to 6.3.1. Bump jacoco-maven-plugin from 0.8.7 to 0.8.8. Bump japicmp-maven-plugin from 0.15.3 to 0.16.0. Bump maven-checkstyle-plugin from 3.1.2 to 3.2.0 #253. Replace FindBugs with SpotBugs #56. Javadoc typo in CSVFormat let's -> lets #57. CSVFormat.printWithEscapes throws StringIndexOutOfBoundsException when value is Reader #61. Improve CSVFormat test coverage #63. Fix CSVFileParserTest.java to allow for a null return value from record.getComment() #62. Improve test coverage in CSVFormatTest #65. Removed invalid Javadoc markup for CSVFormat EXCEL #64. Improve CSVRecord and CSVPrinter code coverage #66. Improve lexer and token coverage #67. CSVFormat.format trims last delimiter if the delimiter is a white space #71. Replace org.apache.commons.csv.Assertions.notNull() with Objects.requireNonNull(). Line number is not proper at EOF. Parser iterates over the last CSV Record twice. Minor improvements #126, #127, #130. Add possibility to use ResultSet header meta data as CSV header #11. Add test cases for withIgnoreSurroundingSpaces() and withTrim() #70. Update CSVParser.parse(File, Charset, CSVFormat) from IO to NIO. Missing separator with print(object) followed by printRecord(Object[]) #157. Fix EOL checking for read array in ExtendedBufferedReader #5. Print from Reader with embedded quotes generates incorrect output #78. Replace JUnit assert by simpler but equivalent calls. #159. Update gitignore to ignore idea and vscode #160. Update CSVBenchmark #165. Remove Whitespace Check Determines Delimiter Twice #167. Document and Automate CSV Benchmark Harness #166. Optimize Lexer Delimiter Check for One Character Delimiter #163. SpotBugs Error: Medium: org.apache.commons.csv.CSVParser.getHeaderNames() may expose internal representation by returning CSVParser.headerNames [org.apache.commons.csv.CSVParser] At CSVParser.java:[line 599] EI_EXPOSE_REP. SpotBugs Error: Medium: new org.apache.commons.csv.CSVParser(Reader, CSVFormat, long, long) may expose internal representation by storing an externally mutable object into CSVParser.format [org.apache.commons.csv.CSVParser] At CSVParser.java:[line 433] EI_EXPOSE_REP2. SpotBugs Error: Medium: new org.apache.commons.csv.CSVParser(Reader, CSVFormat, long, long) may expose internal representation by storing an externally mutable object into CSVParser.headerMap [org.apache.commons.csv.CSVParser] At CSVParser.java:[line 437] EI_EXPOSE_REP2. SpotBugs Error: Medium: new org.apache.commons.csv.CSVParser(Reader, CSVFormat, long, long) may expose internal representation by storing an externally mutable object into CSVParser.headerNames [org.apache.commons.csv.CSVParser] At CSVParser.java:[line 438] EI_EXPOSE_REP2. SpotBugs Error: Medium: new org.apache.commons.csv.CSVPrinter(Appendable, CSVFormat) may expose internal representation by storing an externally mutable object into CSVPrinter.format [org.apache.commons.csv.CSVPrinter] At CSVPrinter.java:[line 100] EI_EXPOSE_REP2. Formalize PerformanceTest #168. Reuse Buffers in Lexer for Delimiter Detection #162. Cleanup and Document Performance Test Harness #170. Update buffer position when reading line comment #120. Make CSVRecord#toList() public. Add CSVRecord#stream(). Add CSVParser#stream(). Make the method CSVRecord.putIn(Map) public. Add test cases for CSVRecord with get(Enum) and toString. #54. Add and use CSVFormat.Builder, deprecated CSVFormat#with methods, based on #73. Add support for String delimiters #76. Update org.junit.jupiter:junit-jupiter from 5.6.0 to 5.7.0, #84 #109 Update tests from Apache Commons Lang 3.9 to 3.12.0. Update tests from commons-io:commons-io 2.6 to 2.11.0, #108. Bump actions/checkout from v1 to v2.3.4, #79, #92, #121. Bump commons-parent from 50 to 51 #80. Bump tests from opencsv from 3.1 to 5.5.1 #81, #137, #158. Update tests from super-csv from 2.2.1 to 2.4.0 #86. Bump build actions/setup-java from v1.4.0 to v2, #101, #113. Bump maven-pmd-plugin from 3.13.0 to 3.14.0 #122. Bump tests from org.mockito:mockito-core 3.2.4 -> 3.11.2; #88, #107, #110, #123, #128, #129, #156. Bump actions/cache from v2 to v2.1.6 #132, #153. Bump maven-checkstyle-plugin from 3.0.0 to 3.1.2 #131. Bump checkstyle from 8.29 to 8.44. Bump junit-jupiter from 5.7.0 to 5.8.0-M1 #133, #149. Bump commons.jacoco.version from 0.8.5 to 0.8.7 (Java 16). Bump commons.spotbugs.version from 4.0.4 to 4.3.0 (Java 16). Bump maven-javadoc-plugin from 3.2.0 to 3.3.0. Bump jmh-generator-annprocess from 1.5.2 to 1.32 #151. Bump PMD core from 6.29.0 to 6.36.0. Bump biz.aQute.bnd:biz.aQute.bndlib from 5.1.2 to 5.3.0. Add CSVRecord.isSet(int) method #52. Char escape doesn't work properly with quoting. Test case failures following CSVFormat#equals() update. CSVFormat withTrim() and withIgnoreSurroundingSpaces() need better docs. CSVFormat equals() and hashCode() don't use all fields. CSVFormat#validate() does not account for allowDuplicateHeaderNames #43. Post 1.7 release fixes. Upgrade test framework to JUnit 5 Jupiter #49, #50. A single empty header is allowed when not allowing empty column headers. #47. CSVRecord is not Serializable. Use test scope for supercsv #48. Update tests from H2 1.4.199 to 1.4.200. Update tests from Hamcrest 2.1 to 2.2. Update tests from Mockito 3.1.0 to 3.2.4. Fix typos in site and test #53. Fix typo performance test #55. Add predefined CSVFormats for printing MongoDB CSV and TSV. Fix escape character for POSTGRESQL_TEXT and POSTGRESQL_CSV formats. Site link "Source Repository" does not work. Add support for java.sql.Clob. Update to Java 8. Escape quotes in CLOBs #39. Cannot get headers in column order from CSVRecord. Update tests from H2 1.4.198 to 1.4.199. Add more documentation to CSVPrinter. Add autoFlush option for CsvPrinter. PR #24. The behavior of quote char using is not similar as Excel does when the first string contains CJK char(s). Don't quote cells just because they have UTF-8 encoded characters. Add API org.apache.commons.csv.CSVFormat.withSystemRecordSeparator(). Inconsistency between Javadoc of CSVFormat DEFAULT EXCEL. Create CSVFormat.ORACLE preset. Some multi-iterator parsing peek sequences incorrectly consume elements. Parse method should avoid creating a redundant BufferedReader. Add predefined CSVFormats for printing MongoDB CSV and TSV. withNullString value is printed without quotes when QuoteMode.ALL is specified; add QuoteMode.ALL_NON_NULL. PR #17. Fix outdated comments about FileReader in CSVParser #13 Fix incorrect method name 'withFirstRowAsHeader' in user guide. Negative numeric values in the first column are always quoted in minimal mode. Update platform requirement from Java 6 to 7. Do not use RuntimeException in CSVParser.iterator().new Iterator() {...}.getNextRecord() CSVParser: Add factory method accepting InputStream. Add convenience API CSVFormat.print(File, Charset) Add convenience API CSVFormat.print(Path, Charset) Add convenience API CSVParser.parse(Path, Charset, CSVFormat) Add convenience API CSVFormat#printer() to print to System.out Provide a CSV Format for printing PostgreSQL CSV and Text formats. Adding a placeholder in the Lexer and CSV parser to store the end-of-line string. Make CSVPrinter.print(Object) GC-free. Allow some printing operations directly from CSVFormat. Drop ferc.gov tests. Add shortcut method for using first record as header to CSVFormat Add withHeader(Class<? extends Enum>) to CSVFormat Comment line hides next record; update Javadoc to make behavior clear CSVPrinter doesn't skip creation of header record if skipHeaderRecord is set to true Add IgnoreCase option for accessing header names The null string should be case-sensitive when reading records CSVFormat.nullString should not be escaped CSVFormat.MYSQL nullString should be "\N" Fix Javadoc to say CSVFormat with() methods return a new CSVFormat Support for ignoring trailing delimiter. Support trimming leading and trailing blanks. Create default formats for Informix UNLOAD and UNLOAD CSV. CSVFormat.with* methods clear the header comments Incorrect Javadoc on QuoteMode.NONE Add enum CSVFormat.Predefined that contains the default CSVFormat values. QuoteMode.NON_NUMERIC doesn't work with CSVPrinter.printRecords(ResultSet) CSVFormat#withHeader doesn't work well with #printComment, add withHeaderComments(String...) CSVFormat.EXCEL should ignore empty header names Incorrect Javadoc referencing org.apache.commons.csv.CSVFormat withQuote() Improve toString() implementation of CSVRecord Unified parameter validation Add CSVFormat#with 0-arg methods matching boolean arg methods Save positions of records to enable random access CSVPrinter.printRecord(ResultSet) with metadata No longer works with Java 6 NullPointerException when empty header string and null string of "" Validate format parameters in constructor IllegalArgumentException thrown when the header contains duplicate names when the column names are empty. CSVFormat#withHeader doesn't work with CSVPrinter CSVFormat is missing a print(...) method CSVRecord.toMap() throws NPE on formats with no headers. Check whether ISE/IAE are being used appropriately CSVFormat constructor should reject a header array with duplicate entries HeaderMap is inconsistent when it is parsed from an input with duplicate columns names CSVRecord.toMap() fails if row length shorter than header length CSVFormat.format allways append null Add Map conversion API to CSVRecord CSVParser: getHeaderMap throws NPE Lots of possible changes Use Character instead of char for char fields except delimiter Revert Builder implementation in CSVFormat CSVRecord does not verify that the length of the header mapping matches the number of values Allow the handling of NULL values Use the Builder pattern for CSVFormat Clarify comment handling CSVParser.nextValue() seems pointless Allow the String value for null to be customized for the CSV printer Not possible to create a CSVFormat from scratch Keep track of record number Lexer should only use char fields Need a way to extract parsed headers, e.g. for use in formatting output Header support Confusing semantic of the ignore leading/trailing spaces parameters Add convenience methods to CSVLexer Is CharBuffer really needed, now that StringBuilder is available? Replace while(true)-loop in CSVParser.getRecord with do-while-loop CSVFormat describes itself as immutable, but it is not - in particular it is not thread-safe Endless loops in CSV parser NullPointerException in CSVPrinter.print()/println() CSVPrinter overhaul Excel strategy uses wrong separator CSVStrategy has modifiable public static variables Predefined format for MYSQL Reduce visibility of methods in internal classes ExtendedBufferedReader does too much Decide whether to keep the csv.writer subpackage