This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-csv.git
The following commit(s) were added to refs/heads/master by this push: new 8568e88 Update CSVParser.parse(File, Charset, CSVFormat) from IO to NIO. 8568e88 is described below commit 8568e8865a0c18e06b282a103bfea01fc443e7bd Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jul 3 15:01:54 2021 -0400 Update CSVParser.parse(File, Charset, CSVFormat) from IO to NIO. --- src/changes/changes.xml | 23 +++++++++++----------- .../java/org/apache/commons/csv/CSVParser.java | 4 +--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 0436273..7893d12 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -40,28 +40,29 @@ <body> <release version="1.9" date="2020-MM-DD" description="Feature and bug fix release (Java 8)"> <!-- FIX --> - <action type="add" dev="ggregory" due-to="dota17">Add test cases for CSVRecord with get(Enum) and toString. #54.</action> - <action type="update" dev="ggregory" due-to="Amey Jadiye">Replace FindBugs with SpotBugs #56.</action> - <action type="update" dev="ggregory" due-to="Chen">Javadoc typo in CSVFormat let's -> lets #57.</action> + <action type="fix" dev="ggregory" due-to="Amey Jadiye">Replace FindBugs with SpotBugs #56.</action> + <action type="fix" dev="ggregory" due-to="Chen">Javadoc typo in CSVFormat let's -> lets #57.</action> <action issue="CSV-259" type="fix" dev="ggregory" due-to="Chen">CSVFormat.printWithEscapes throws StringIndexOutOfBoundsException when value is Reader #61.</action> - <action issue="CSV-184" type="add" dev="ggregory" due-to="Gaurav Agarwal, M. Steiger, Gary Gregory">Make the method CSVRecord.putIn(Map) public.</action> - <action type="update" dev="ggregory" due-to="Chen">Improve CSVFormat test coverage #63.</action> - <action type="update" dev="ggregory" due-to="Chen">Fix CSVFileParserTest.java to allow for a null return value from record.getComment() #62.</action> - <action type="update" dev="ggregory" due-to="Chen">Improve test coverage in CSVFormatTest #65.</action> - <action type="update" dev="ggregory" due-to="Chen">Removed invalid Javadoc markup for CSVFormat EXCEL #64.</action> - <action type="update" dev="ggregory" due-to="Chen">Improve CSVRecord and CSVPrinter code coverage #66.</action> - <action type="update" dev="ggregory" due-to="Chen">Improve lexer and token coverage #67.</action> + <action type="fix" dev="ggregory" due-to="Chen">Improve CSVFormat test coverage #63.</action> + <action type="fix" dev="ggregory" due-to="Chen">Fix CSVFileParserTest.java to allow for a null return value from record.getComment() #62.</action> + <action type="fix" dev="ggregory" due-to="Chen">Improve test coverage in CSVFormatTest #65.</action> + <action type="fix" dev="ggregory" due-to="Chen">Removed invalid Javadoc markup for CSVFormat EXCEL #64.</action> + <action type="fix" dev="ggregory" due-to="Chen">Improve CSVRecord and CSVPrinter code coverage #66.</action> + <action type="fix" dev="ggregory" due-to="Chen">Improve lexer and token coverage #67.</action> <action issue="CSV-211" type="fix" dev="ggregory" due-to="Alpesh Kulkarni, Chen">CSVFormat.format trims last delimiter if the delimiter is a white space #71.</action> - <action type="update" dev="ggregory" due-to="Gary Gregory">Replace org.apache.commons.csv.Assertions.notNull() with Objects.requireNonNull().</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">Replace org.apache.commons.csv.Assertions.notNull() with Objects.requireNonNull().</action> <action issue="CSV-149" type="fix" dev="ggregory" due-to="Kranthi, Gary Gregory, Brent Worden, dota17">Line number is not proper at EOF.</action> <action issue="CSV-195" type="fix" dev="ggregory" due-to="Rodolfo Duldulao, Rodolfo Duldulao, Michael Vitz, dota17">Parser iterates over the last CSV Record twice.</action> <action issue="CSV-267" type="fix" dev="ggregory" due-to="Arturo Bernal">Minor improvements #126, #127, #130.</action> <action issue="CSV-123" type="fix" dev="ggregory" due-to="Emmanuel Bourg, Benedikt Ritter, shivakrishnaah, Gary Gregory">Add possibility to use ResultSet header meta data as CSV header #11.</action> <action issue="CSV-148" type="fix" dev="ggregory" due-to="dota17">Add test cases for withIgnoreSurroundingSpaces() and withTrim() #70.</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">Update CSVParser.parse(File, Charset, CSVFormat) from IO to NIO.</action> <!-- ADD --> <action issue="CSV-275" type="add" dev="ggregory" due-to="Michael Wyraz, Gary Gregory">Make CSVRecord#toList() public.</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add CSVRecord#stream().</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add CSVParser#stream().</action> + <action issue="CSV-184" type="add" dev="ggregory" due-to="Gaurav Agarwal, M. Steiger, Gary Gregory">Make the method CSVRecord.putIn(Map) public.</action> + <action type="add" dev="ggregory" due-to="dota17">Add test cases for CSVRecord with get(Enum) and toString. #54.</action> <!-- UPDATE --> <action type="update" dev="ggregory" due-to="Gary Gregory">Update org.junit.jupiter:junit-jupiter from 5.6.0 to 5.7.0, #84 #109</action> <action type="update" dev="ggregory" due-to="Gary Gregory">Update tests from Apache Commons Lang 3.9 to 3.12.0.</action> diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java b/src/main/java/org/apache/commons/csv/CSVParser.java index 11ea355..1df57fa 100644 --- a/src/main/java/org/apache/commons/csv/CSVParser.java +++ b/src/main/java/org/apache/commons/csv/CSVParser.java @@ -223,11 +223,9 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable { * @throws IOException * If an I/O error occurs */ - @SuppressWarnings("resource") public static CSVParser parse(final File file, final Charset charset, final CSVFormat format) throws IOException { Objects.requireNonNull(file, "file"); - Objects.requireNonNull(format, "format"); - return new CSVParser(new InputStreamReader(new FileInputStream(file), charset), format); + return parse(file.toPath(), charset, format); } /**