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-net.git
commit 6233349516aaf3e75ab88f98c96aaa2fa9ccb087 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Wed Jul 19 09:31:05 2023 -0400 Use try-with-resources --- .../java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java b/src/test/java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java index 72a5c6b2..e0667249 100644 --- a/src/test/java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java +++ b/src/test/java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java @@ -384,10 +384,9 @@ public class POP3ClientCommandsTest extends TestCase { assertTrue(msg.length > 0); for (int i = 0; i < msg.length; i++) { - Reader r = pop3Client.retrieveMessageTop(i + 1, numLines); - assertNotNull(r); - r.close(); - r = null; + try (Reader reader = pop3Client.retrieveMessageTop(i + 1, numLines)) { + assertNotNull(reader); + } } }