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

commit 4e3262b855185f14b44ede924b09ee5e54aef81d
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Apr 6 08:18:14 2024 -0400

    Always use blocks
    
    Use final
---
 .../java/org/apache/commons/csv/CSVParserTest.java     | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/test/java/org/apache/commons/csv/CSVParserTest.java 
b/src/test/java/org/apache/commons/csv/CSVParserTest.java
index 261307e6..601cef0c 100644
--- a/src/test/java/org/apache/commons/csv/CSVParserTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVParserTest.java
@@ -1376,27 +1376,24 @@ public class CSVParserTest {
     }
     @Test
     public void testParsingPrintedEmptyFirstColumn() throws Exception {
-        String[][] lines = new String[][] {
-                {"a", "b"},
-                {"", "x"}
-        };
+        final String[][] lines = { { "a", "b" }, { "", "x" } };
         Exception firstException = null;
-        for (CSVFormat.Predefined format : CSVFormat.Predefined.values()) {
+        for (final CSVFormat.Predefined format : 
CSVFormat.Predefined.values()) {
             try {
-                StringWriter buf = new StringWriter();
+                final StringWriter buf = new StringWriter();
                 try (CSVPrinter printer = new CSVPrinter(buf, 
format.getFormat())) {
-                    for (String[] line : lines) {
+                    for (final String[] line : lines) {
                         printer.printRecord((Object[]) line);
                     }
                 }
                 try (CSVParser csvRecords = new CSVParser(new 
StringReader(buf.toString()), format.getFormat())) {
-                    for (String[] line : lines) {
+                    for (final String[] line : lines) {
                         assertArrayEquals(line, 
csvRecords.nextRecord().values());
                     }
                     assertNull(csvRecords.nextRecord());
                 }
             } catch (Exception | Error e) {
-                Exception detailedException = new RuntimeException("format: " 
+ format, e);
+                final Exception detailedException = new 
RuntimeException("format: " + format, e);
                 if (firstException == null) {
                     firstException = detailedException;
                 } else {
@@ -1405,8 +1402,9 @@ public class CSVParserTest {
             }
         }
 
-        if (firstException != null)
+        if (firstException != null) {
             throw firstException;
+        }
     }
 
     @Test

Reply via email to