Skip to content

Commit 4e3262b

Browse files
committed
Always use blocks
Use final
1 parent bdd72a2 commit 4e3262b

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,27 +1376,24 @@ public void testParseWithQuoteWithEscape() throws IOException {
13761376
}
13771377
@Test
13781378
public void testParsingPrintedEmptyFirstColumn() throws Exception {
1379-
String[][] lines = new String[][] {
1380-
{"a", "b"},
1381-
{"", "x"}
1382-
};
1379+
final String[][] lines = { { "a", "b" }, { "", "x" } };
13831380
Exception firstException = null;
1384-
for (CSVFormat.Predefined format : CSVFormat.Predefined.values()) {
1381+
for (final CSVFormat.Predefined format : CSVFormat.Predefined.values()) {
13851382
try {
1386-
StringWriter buf = new StringWriter();
1383+
final StringWriter buf = new StringWriter();
13871384
try (CSVPrinter printer = new CSVPrinter(buf, format.getFormat())) {
1388-
for (String[] line : lines) {
1385+
for (final String[] line : lines) {
13891386
printer.printRecord((Object[]) line);
13901387
}
13911388
}
13921389
try (CSVParser csvRecords = new CSVParser(new StringReader(buf.toString()), format.getFormat())) {
1393-
for (String[] line : lines) {
1390+
for (final String[] line : lines) {
13941391
assertArrayEquals(line, csvRecords.nextRecord().values());
13951392
}
13961393
assertNull(csvRecords.nextRecord());
13971394
}
13981395
} catch (Exception | Error e) {
1399-
Exception detailedException = new RuntimeException("format: " + format, e);
1396+
final Exception detailedException = new RuntimeException("format: " + format, e);
14001397
if (firstException == null) {
14011398
firstException = detailedException;
14021399
} else {
@@ -1405,8 +1402,9 @@ public void testParsingPrintedEmptyFirstColumn() throws Exception {
14051402
}
14061403
}
14071404

1408-
if (firstException != null)
1405+
if (firstException != null) {
14091406
throw firstException;
1407+
}
14101408
}
14111409

14121410
@Test

0 commit comments

Comments
 (0)