Skip to content

Commit 8568e88

Browse files
committed
Update CSVParser.parse(File, Charset, CSVFormat) from IO to NIO.
1 parent 83ad213 commit 8568e88

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

src/changes/changes.xml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,29 @@
4040
<body>
4141
<release version="1.9" date="2020-MM-DD" description="Feature and bug fix release (Java 8)">
4242
<!-- FIX -->
43-
<action type="add" dev="ggregory" due-to="dota17">Add test cases for CSVRecord with get(Enum) and toString. #54.</action>
44-
<action type="update" dev="ggregory" due-to="Amey Jadiye">Replace FindBugs with SpotBugs #56.</action>
45-
<action type="update" dev="ggregory" due-to="Chen">Javadoc typo in CSVFormat let's -> lets #57.</action>
43+
<action type="fix" dev="ggregory" due-to="Amey Jadiye">Replace FindBugs with SpotBugs #56.</action>
44+
<action type="fix" dev="ggregory" due-to="Chen">Javadoc typo in CSVFormat let's -> lets #57.</action>
4645
<action issue="CSV-259" type="fix" dev="ggregory" due-to="Chen">CSVFormat.printWithEscapes throws StringIndexOutOfBoundsException when value is Reader #61.</action>
47-
<action issue="CSV-184" type="add" dev="ggregory" due-to="Gaurav Agarwal, M. Steiger, Gary Gregory">Make the method CSVRecord.putIn(Map) public.</action>
48-
<action type="update" dev="ggregory" due-to="Chen">Improve CSVFormat test coverage #63.</action>
49-
<action type="update" dev="ggregory" due-to="Chen">Fix CSVFileParserTest.java to allow for a null return value from record.getComment() #62.</action>
50-
<action type="update" dev="ggregory" due-to="Chen">Improve test coverage in CSVFormatTest #65.</action>
51-
<action type="update" dev="ggregory" due-to="Chen">Removed invalid Javadoc markup for CSVFormat EXCEL #64.</action>
52-
<action type="update" dev="ggregory" due-to="Chen">Improve CSVRecord and CSVPrinter code coverage #66.</action>
53-
<action type="update" dev="ggregory" due-to="Chen">Improve lexer and token coverage #67.</action>
46+
<action type="fix" dev="ggregory" due-to="Chen">Improve CSVFormat test coverage #63.</action>
47+
<action type="fix" dev="ggregory" due-to="Chen">Fix CSVFileParserTest.java to allow for a null return value from record.getComment() #62.</action>
48+
<action type="fix" dev="ggregory" due-to="Chen">Improve test coverage in CSVFormatTest #65.</action>
49+
<action type="fix" dev="ggregory" due-to="Chen">Removed invalid Javadoc markup for CSVFormat EXCEL #64.</action>
50+
<action type="fix" dev="ggregory" due-to="Chen">Improve CSVRecord and CSVPrinter code coverage #66.</action>
51+
<action type="fix" dev="ggregory" due-to="Chen">Improve lexer and token coverage #67.</action>
5452
<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>
55-
<action type="update" dev="ggregory" due-to="Gary Gregory">Replace org.apache.commons.csv.Assertions.notNull() with Objects.requireNonNull().</action>
53+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Replace org.apache.commons.csv.Assertions.notNull() with Objects.requireNonNull().</action>
5654
<action issue="CSV-149" type="fix" dev="ggregory" due-to="Kranthi, Gary Gregory, Brent Worden, dota17">Line number is not proper at EOF.</action>
5755
<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>
5856
<action issue="CSV-267" type="fix" dev="ggregory" due-to="Arturo Bernal">Minor improvements #126, #127, #130.</action>
5957
<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>
6058
<action issue="CSV-148" type="fix" dev="ggregory" due-to="dota17">Add test cases for withIgnoreSurroundingSpaces() and withTrim() #70.</action>
59+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Update CSVParser.parse(File, Charset, CSVFormat) from IO to NIO.</action>
6160
<!-- ADD -->
6261
<action issue="CSV-275" type="add" dev="ggregory" due-to="Michael Wyraz, Gary Gregory">Make CSVRecord#toList() public.</action>
6362
<action type="add" dev="ggregory" due-to="Gary Gregory">Add CSVRecord#stream().</action>
6463
<action type="add" dev="ggregory" due-to="Gary Gregory">Add CSVParser#stream().</action>
64+
<action issue="CSV-184" type="add" dev="ggregory" due-to="Gaurav Agarwal, M. Steiger, Gary Gregory">Make the method CSVRecord.putIn(Map) public.</action>
65+
<action type="add" dev="ggregory" due-to="dota17">Add test cases for CSVRecord with get(Enum) and toString. #54.</action>
6566
<!-- UPDATE -->
6667
<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>
6768
<action type="update" dev="ggregory" due-to="Gary Gregory">Update tests from Apache Commons Lang 3.9 to 3.12.0.</action>

src/main/java/org/apache/commons/csv/CSVParser.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,9 @@ private static final class Headers {
223223
* @throws IOException
224224
* If an I/O error occurs
225225
*/
226-
@SuppressWarnings("resource")
227226
public static CSVParser parse(final File file, final Charset charset, final CSVFormat format) throws IOException {
228227
Objects.requireNonNull(file, "file");
229-
Objects.requireNonNull(format, "format");
230-
return new CSVParser(new InputStreamReader(new FileInputStream(file), charset), format);
228+
return parse(file.toPath(), charset, format);
231229
}
232230

233231
/**

0 commit comments

Comments
 (0)