From 5d16917835d11da3b07d68b6658447988f76200d Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 3 Jul 2021 16:40:37 -0400 Subject: [PATCH] Use try-with-resources. Better local var name. --- src/test/java/org/apache/commons/csv/CSVPrinterTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java index 4d60a3bc..c5680b7f 100644 --- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java +++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java @@ -1601,12 +1601,12 @@ public class CSVPrinterTest { return CSVParser.parse(expected, format).getRecords().get(0).values(); } - private void tryFormat(final List l, final Character quote, final Character escape, final String expected) throws IOException { + private void tryFormat(final List list, final Character quote, final Character escape, final String expected) throws IOException { final CSVFormat format = CSVFormat.DEFAULT.withQuote(quote).withEscape(escape).withRecordSeparator(null); final Appendable out = new StringBuilder(); - final CSVPrinter printer = new CSVPrinter(out, format); - printer.printRecord(l); - printer.close(); + try (final CSVPrinter printer = new CSVPrinter(out, format)) { + printer.printRecord(list); + } assertEquals(expected, out.toString()); } }