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-io.git


The following commit(s) were added to refs/heads/master by this push:
     new 8f8e48d  Use try-with-resources. Javadoc.
8f8e48d is described below

commit 8f8e48dfb5b1361128e47c64ee960a700f940f10
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Jul 10 10:45:59 2021 -0400

    Use try-with-resources. Javadoc.
---
 .../org/apache/commons/io/input/ProxyReaderTest.java  | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/input/ProxyReaderTest.java 
b/src/test/java/org/apache/commons/io/input/ProxyReaderTest.java
index fdaea8f..f1dac52 100644
--- a/src/test/java/org/apache/commons/io/input/ProxyReaderTest.java
+++ b/src/test/java/org/apache/commons/io/input/ProxyReaderTest.java
@@ -24,25 +24,22 @@ import org.junit.jupiter.api.Test;
 
 /**
  * Test {@link ProxyReader}.
- *
  */
 public class ProxyReaderTest {
 
     @Test
     public void testNullCharArray() throws Exception {
-
-        final ProxyReader proxy = new ProxyReaderImpl(new CustomNullReader(0));
-        proxy.read((char[])null);
-        proxy.read(null, 0, 0);
-        proxy.close();
+        try (final ProxyReader proxy = new ProxyReaderImpl(new 
CustomNullReader(0))) {
+            proxy.read((char[]) null);
+            proxy.read(null, 0, 0);
+        }
     }
 
     @Test
     public void testNullCharBuffer() throws Exception {
-
-        final ProxyReader proxy = new ProxyReaderImpl(new CustomNullReader(0));
-        proxy.read((CharBuffer)null);
-        proxy.close();
+        try (final ProxyReader proxy = new ProxyReaderImpl(new 
CustomNullReader(0))) {
+            proxy.read((CharBuffer) null);
+        }
     }
 
     /** ProxyReader implementation */
@@ -57,10 +54,12 @@ public class ProxyReaderTest {
         CustomNullReader(final int len) {
             super(len);
         }
+
         @Override
         public int read(final char[] chars) throws IOException {
             return chars == null ? 0 : super.read(chars);
         }
+
         @Override
         public int read(final CharBuffer target) throws IOException {
             return target == null ? 0 : super.read(target);

Reply via email to