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 26736b703b2c121c0c33ec5128fd8a5053183084
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Jun 16 08:41:58 2024 -0400

    Add @SuppressWarnings
---
 .../java/org/apache/commons/net/examples/ftp/FTPClientExample.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java 
b/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java
index b7928d5b..580312d6 100644
--- a/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java
+++ b/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java
@@ -22,6 +22,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.PrintWriter;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.time.Duration;
@@ -280,7 +281,9 @@ public final class FTPClientExample {
         ftp.setListHiddenFiles(hidden);
 
         // suppress login details
-        ftp.addProtocolCommandListener(new 
PrintCommandListener(Util.newPrintWriter(System.out), true));
+        @SuppressWarnings("resource")
+        final PrintWriter printWriter = Util.newPrintWriter(System.out);
+        ftp.addProtocolCommandListener(new PrintCommandListener(printWriter, 
true));
 
         final FTPClientConfig config;
         if (serverType != null) {

Reply via email to