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 8221fcd060cdf60b5446b5b28f8668435ba4447b
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Jun 16 08:40:02 2024 -0400

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

diff --git 
a/src/main/java/org/apache/commons/net/examples/ftp/ServerToServerFTP.java 
b/src/main/java/org/apache/commons/net/examples/ftp/ServerToServerFTP.java
index 36b3c1c4..d8d8b46b 100644
--- a/src/main/java/org/apache/commons/net/examples/ftp/ServerToServerFTP.java
+++ b/src/main/java/org/apache/commons/net/examples/ftp/ServerToServerFTP.java
@@ -18,6 +18,7 @@
 package org.apache.commons.net.examples.ftp;
 
 import java.io.IOException;
+import java.io.PrintWriter;
 import java.net.InetAddress;
 
 import org.apache.commons.net.PrintCommandListener;
@@ -74,7 +75,9 @@ public final class ServerToServerFTP {
         password2 = args[6];
         file2 = args[7];
 
-        listener = new PrintCommandListener(Util.newPrintWriter(System.out), 
true);
+        @SuppressWarnings("resource") // Don't close System.out
+        final PrintWriter printWriter = Util.newPrintWriter(System.out);
+        listener = new PrintCommandListener(printWriter, true);
         ftp1 = new FTPClient();
         ftp1.addProtocolCommandListener(listener);
         ftp2 = new FTPClient();

Reply via email to