File tree Expand file tree Collapse file tree
src/test/java/org/apache/commons/io/input Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424
2525/**
2626 * Test {@link ProxyReader}.
27- *
2827 */
2928public class ProxyReaderTest {
3029
3130 @ Test
3231 public void testNullCharArray () throws Exception {
33-
34- final ProxyReader proxy = new ProxyReaderImpl (new CustomNullReader (0 ));
35- proxy .read ((char [])null );
36- proxy .read (null , 0 , 0 );
37- proxy .close ();
32+ try (final ProxyReader proxy = new ProxyReaderImpl (new CustomNullReader (0 ))) {
33+ proxy .read ((char []) null );
34+ proxy .read (null , 0 , 0 );
35+ }
3836 }
3937
4038 @ Test
4139 public void testNullCharBuffer () throws Exception {
42-
43- final ProxyReader proxy = new ProxyReaderImpl (new CustomNullReader (0 ));
44- proxy .read ((CharBuffer )null );
45- proxy .close ();
40+ try (final ProxyReader proxy = new ProxyReaderImpl (new CustomNullReader (0 ))) {
41+ proxy .read ((CharBuffer ) null );
42+ }
4643 }
4744
4845 /** ProxyReader implementation */
@@ -57,10 +54,12 @@ private static class CustomNullReader extends NullReader {
5754 CustomNullReader (final int len ) {
5855 super (len );
5956 }
57+
6058 @ Override
6159 public int read (final char [] chars ) throws IOException {
6260 return chars == null ? 0 : super .read (chars );
6361 }
62+
6463 @ Override
6564 public int read (final CharBuffer target ) throws IOException {
6665 return target == null ? 0 : super .read (target );
You can’t perform that action at this time.
0 commit comments