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 33129ba46724176c9853c824c80e80ec21991643
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Sep 14 09:44:01 2024 -0400

    Use try-with-resources
---
 src/test/java/org/apache/commons/csv/LexerTest.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/csv/LexerTest.java 
b/src/test/java/org/apache/commons/csv/LexerTest.java
index 3bc55a00..e6ccaea5 100644
--- a/src/test/java/org/apache/commons/csv/LexerTest.java
+++ b/src/test/java/org/apache/commons/csv/LexerTest.java
@@ -452,8 +452,9 @@ public class LexerTest {
     @Test
     public void testTrimTrailingSpacesZeroLength() throws Exception {
         final StringBuilder buffer = new StringBuilder("");
-        final Lexer lexer = createLexer(buffer.toString(), CSVFormat.DEFAULT);
-        lexer.trimTrailingSpaces(buffer);
-        assertThat(lexer.nextToken(new Token()), matches(EOF, ""));
+        try (Lexer lexer = createLexer(buffer.toString(), CSVFormat.DEFAULT)) {
+            lexer.trimTrailingSpaces(buffer);
+            assertThat(lexer.nextToken(new Token()), matches(EOF, ""));
+        }
     }
 }

Reply via email to