You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/12/23 16:16:55 UTC

(commons-net) branch master updated: Use StandardCharsets

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


The following commit(s) were added to refs/heads/master by this push:
     new 56e30314 Use StandardCharsets
56e30314 is described below

commit 56e30314bb60724ae77cceddf063fd72fca2ab96
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Dec 23 11:16:50 2023 -0500

    Use StandardCharsets
---
 src/main/java/org/apache/commons/net/ftp/FTP.java   | 3 ++-
 src/main/java/org/apache/commons/net/smtp/SMTP.java | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ftp/FTP.java b/src/main/java/org/apache/commons/net/ftp/FTP.java
index 9c860fdb..9ddca241 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTP.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTP.java
@@ -28,6 +28,7 @@ import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.SocketException;
 import java.net.SocketTimeoutException;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 
 import org.apache.commons.net.MalformedServerReplyException;
@@ -157,7 +158,7 @@ public class FTP extends SocketClient {
      * The default character encoding used for communicating over an FTP control connection. The default encoding is an ASCII-compatible encoding. Some FTP
      * servers expect other encodings. You can change the encoding used by an FTP instance with {@link #setControlEncoding setControlEncoding}.
      */
-    public static final String DEFAULT_CONTROL_ENCODING = "ISO-8859-1";
+    public static final String DEFAULT_CONTROL_ENCODING = StandardCharsets.ISO_8859_1.name();
 
     /** Length of the FTP reply code (3 alphanumerics) */
     public static final int REPLY_CODE_LEN = 3;
diff --git a/src/main/java/org/apache/commons/net/smtp/SMTP.java b/src/main/java/org/apache/commons/net/smtp/SMTP.java
index 589d402d..92a9a6fc 100644
--- a/src/main/java/org/apache/commons/net/smtp/SMTP.java
+++ b/src/main/java/org/apache/commons/net/smtp/SMTP.java
@@ -22,6 +22,7 @@ import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 
 import org.apache.commons.net.MalformedServerReplyException;
@@ -66,7 +67,7 @@ public class SMTP extends SocketClient {
     // We have to ensure that the protocol communication is in ASCII,
     // but we use ISO-8859-1 just in case 8-bit characters cross
     // the wire.
-    private static final String DEFAULT_ENCODING = "ISO-8859-1";
+    private static final String DEFAULT_ENCODING = StandardCharsets.ISO_8859_1.name();
 
     /**
      * The encoding to use (user-settable).