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 3cb18ec82ef0b3640536137639763a682994a61e
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Mar 13 10:12:42 2026 -0400

    Deprecate Util.copyReader(Reader, Writer) in favor of
    IOUtils.copyLarge()
---
 src/changes/changes.xml                                             | 2 ++
 src/main/java/org/apache/commons/net/examples/mail/SMTPMail.java    | 3 +--
 src/main/java/org/apache/commons/net/examples/nntp/PostMessage.java | 4 ++--
 src/main/java/org/apache/commons/net/io/Util.java                   | 2 ++
 src/main/java/org/apache/commons/net/nntp/NNTPClient.java           | 3 +--
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b18ee03f..90a1a6ad 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,6 +77,8 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix typo in 
FTPConnectionClosedException message from FTP.getReply(boolean).</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Reimplement 
Util.copyReader() with IOUtils.copyLarge().</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Reimplement 
Util.copyStream() with IOUtils.copyLarge().</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Reimplement 
Util.copyStream() with IOUtils.copyLarge().</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate 
Util.copyReader(Reader, Writer) in favor of IOUtils.copyLarge(Reader, 
Writer).</action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
DatagramSocketClient.getDefaultTimeoutDuration() and deprecate 
getDefaultTimeout().</action>
       <action type="add" dev="ggregory" due-to="Maros Orsak, Gary Gregory" 
issue="NET-741">Add subnet IPv6 handling with SubnetUtils6 #391.</action>
diff --git a/src/main/java/org/apache/commons/net/examples/mail/SMTPMail.java 
b/src/main/java/org/apache/commons/net/examples/mail/SMTPMail.java
index 993a5494..98d783d5 100644
--- a/src/main/java/org/apache/commons/net/examples/mail/SMTPMail.java
+++ b/src/main/java/org/apache/commons/net/examples/mail/SMTPMail.java
@@ -30,7 +30,6 @@ import java.util.List;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.net.examples.PrintCommandListeners;
-import org.apache.commons.net.io.Util;
 import org.apache.commons.net.smtp.SMTPClient;
 import org.apache.commons.net.smtp.SMTPReply;
 import org.apache.commons.net.smtp.SimpleSMTPHeader;
@@ -132,7 +131,7 @@ public final class SMTPMail {
 
             if (writer != null) {
                 writer.write(header.toString());
-                Util.copyReader(fileReader, writer);
+                IOUtils.copyLarge(fileReader, writer);
                 writer.close();
                 client.completePendingCommand();
             }
diff --git 
a/src/main/java/org/apache/commons/net/examples/nntp/PostMessage.java 
b/src/main/java/org/apache/commons/net/examples/nntp/PostMessage.java
index a8eaee31..5988d5dc 100644
--- a/src/main/java/org/apache/commons/net/examples/nntp/PostMessage.java
+++ b/src/main/java/org/apache/commons/net/examples/nntp/PostMessage.java
@@ -27,8 +27,8 @@ import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.net.examples.PrintCommandListeners;
-import org.apache.commons.net.io.Util;
 import org.apache.commons.net.nntp.NNTPClient;
 import org.apache.commons.net.nntp.NNTPReply;
 import org.apache.commons.net.nntp.SimpleNNTPHeader;
@@ -147,7 +147,7 @@ public final class PostMessage {
 
                 if (writer != null) {
                     writer.write(header.toString());
-                    Util.copyReader(fileReader, writer);
+                    IOUtils.copyLarge(fileReader, writer);
                     writer.close();
                     client.completePendingCommand();
                 }
diff --git a/src/main/java/org/apache/commons/net/io/Util.java 
b/src/main/java/org/apache/commons/net/io/Util.java
index cc1e6221..c456542d 100644
--- a/src/main/java/org/apache/commons/net/io/Util.java
+++ b/src/main/java/org/apache/commons/net/io/Util.java
@@ -80,7 +80,9 @@ public final class Util {
      * @param dest   where to copy to
      * @return number of bytes copied
      * @throws CopyStreamException on error
+     * @deprecated Use {@link IOUtils#copy(Reader, Writer)}.
      */
+    @Deprecated
     public static long copyReader(final Reader source, final Writer dest) 
throws CopyStreamException {
         return copyReader(source, dest, DEFAULT_COPY_BUFFER_SIZE);
     }
diff --git a/src/main/java/org/apache/commons/net/nntp/NNTPClient.java 
b/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
index b584fa29..a224fbdd 100644
--- a/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
+++ b/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
@@ -29,7 +29,6 @@ import org.apache.commons.io.IOUtils;
 import org.apache.commons.net.MalformedServerReplyException;
 import org.apache.commons.net.io.DotTerminatedMessageReader;
 import org.apache.commons.net.io.DotTerminatedMessageWriter;
-import org.apache.commons.net.io.Util;
 import org.apache.commons.net.util.NetConstants;
 
 /**
@@ -412,7 +411,7 @@ public class NNTPClient extends NNTP {
         }
 
         try (StringWriter help = new StringWriter(); BufferedReader reader = 
new DotTerminatedMessageReader(_reader_)) {
-            Util.copyReader(reader, help);
+            IOUtils.copyLarge(reader, help);
             return help.toString();
         }
     }

Reply via email to