Skip to content

Commit 4a865fd

Browse files
committed
2 parents 50f4525 + 86186dd commit 4a865fd

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@
442442
<dependency>
443443
<groupId>com.opencsv</groupId>
444444
<artifactId>opencsv</artifactId>
445-
<version>5.7.0</version>
445+
<version>5.7.1</version>
446446
<scope>test</scope>
447447
</dependency>
448448

src/changes/changes.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump mockito-core from 3.11.2 to 4.8.1 #187, #197, #204, #212, #230, #237, #251, #259.</action>
7474
<action type="update" dev="ggregory" due-to="Dependabot">Bump maven-pmd-plugin from 3.14.0 to 3.19.0 #184, #219, #238, #254, #258.</action>
7575
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump pmd from 6.36.0 to 6.50.0 #173, #189, #193, #199, #227, #233, #214, #236, #240, #247, #255, #273.</action>
76-
<action type="update" dev="ggregory" due-to="Gary Gregory">Bump opencsv from 5.5.1 to 5.7.0 #182, #221, #260.</action>
76+
<action type="update" dev="ggregory" due-to="Gary Gregory">Bump opencsv from 5.5.1 to 5.7.1 #182, #221, #260, #281.</action>
7777
<action type="update" dev="ggregory" due-to="Dependabot">Bump spotbugs-maven-plugin from 4.3.0 to 4.7.2.1 #192, #198, #203, #211, #225, #234, #242, #245, #261, #275.</action>
7878
<action type="update" dev="ggregory" due-to="Gary Gregory">Bump com.github.spotbugs:spotbugs from 4.5.3 to 4.7.2.</action>
7979
<action type="update" dev="kinow" due-to="Dependabot">Bump h2 from 1.4.200 to 2.1.214 #200, #205, #213, #239.</action>

src/test/java/org/apache/commons/csv/CSVParserTest.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,10 @@ public void testHeadersWithNullColumnName() throws IOException {
906906
final Iterator<CSVRecord> records = parser.iterator();
907907
final CSVRecord record = records.next();
908908
// Expect the null header to be missing
909-
assertEquals(Arrays.asList("header1", "header3"), record.getParser().getHeaderNames());
910-
assertEquals(2, record.getParser().getHeaderMap().size());
909+
@SuppressWarnings("resource")
910+
final CSVParser recordParser = record.getParser();
911+
assertEquals(Arrays.asList("header1", "header3"), recordParser.getHeaderNames());
912+
assertEquals(2, recordParser.getHeaderMap().size());
911913
}
912914
}
913915

@@ -1133,7 +1135,8 @@ public void testParse() throws Exception {
11331135
final CSVFormat format = CSVFormat.DEFAULT.withHeader("A", "B", "C", "D");
11341136
final Charset charset = StandardCharsets.UTF_8;
11351137

1136-
try (final CSVParser parser = CSVParser.parse(new InputStreamReader(url.openStream(), charset), format)) {
1138+
try (@SuppressWarnings("resource") // CSVParser closes the input resource
1139+
final CSVParser parser = CSVParser.parse(new InputStreamReader(url.openStream(), charset), format)) {
11371140
parseFully(parser);
11381141
}
11391142
try (final CSVParser parser = CSVParser.parse(new String(Files.readAllBytes(Paths.get(url.toURI())), charset), format)) {
@@ -1142,7 +1145,8 @@ public void testParse() throws Exception {
11421145
try (final CSVParser parser = CSVParser.parse(new File(url.toURI()), charset, format)) {
11431146
parseFully(parser);
11441147
}
1145-
try (final CSVParser parser = CSVParser.parse(url.openStream(), charset, format)) {
1148+
try (@SuppressWarnings("resource") // CSVParser closes the input resource
1149+
final CSVParser parser = CSVParser.parse(url.openStream(), charset, format)) {
11461150
parseFully(parser);
11471151
}
11481152
try (final CSVParser parser = CSVParser.parse(Paths.get(url.toURI()), charset, format)) {
@@ -1314,7 +1318,9 @@ public void testRepeatedHeadersAreReturnedInCSVRecordHeaderNames() throws IOExce
13141318
try (final CSVParser parser = CSVFormat.DEFAULT.withFirstRecordAsHeader().withTrim().parse(in)) {
13151319
final Iterator<CSVRecord> records = parser.iterator();
13161320
final CSVRecord record = records.next();
1317-
assertEquals(Arrays.asList("header1", "header2", "header1"), record.getParser().getHeaderNames());
1321+
@SuppressWarnings("resource")
1322+
final CSVParser recordParser = record.getParser();
1323+
assertEquals(Arrays.asList("header1", "header2", "header1"), recordParser.getHeaderNames());
13181324
}}
13191325

13201326
@Test

0 commit comments

Comments
 (0)