You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/04/13 13:35:20 UTC

[camel] 10/12: CAMEL-17962: cleanup duplicated charset features in camel-smpp

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 880b6691114685415512c2a883d1dad19794403a
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Apr 13 13:59:07 2022 +0200

    CAMEL-17962: cleanup duplicated charset features in camel-smpp
---
 .../main/java/org/apache/camel/component/smpp/SmppConstants.java   | 1 -
 .../main/java/org/apache/camel/component/smpp/SmppSmCommand.java   | 7 ++++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConstants.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConstants.java
index 651d2526e81..56736b1bb88 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConstants.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConstants.java
@@ -277,6 +277,5 @@ public interface SmppConstants {
               javaType = "String")
     String SPLITTING_POLICY = "CamelSmppSplittingPolicy";
 
-    String UCS2_ENCODING = "UTF-16BE";
     byte UNKNOWN_ALPHABET = -1;
 }
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
index 4724124b326..97dcb6cb66a 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppSmCommand.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.smpp;
 
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.camel.Message;
 import org.jsmpp.bean.Alphabet;
@@ -30,8 +31,8 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
     // FIXME: these constants should be defined somewhere in jSMPP:
     public static final int SMPP_NEG_RESPONSE_MSG_TOO_LONG = 1;
 
-    protected Charset ascii = Charset.forName("US-ASCII");
-    protected Charset latin1 = Charset.forName("ISO-8859-1");
+    protected Charset ascii = StandardCharsets.US_ASCII;
+    protected Charset latin1 = StandardCharsets.ISO_8859_1;
     protected Charset defaultCharset;
 
     private final Logger logger = LoggerFactory.getLogger(SmppSmCommand.class);
@@ -151,7 +152,7 @@ public abstract class SmppSmCommand extends AbstractSmppCommand {
         if (providedAlphabet == Alphabet.ALPHA_UCS2.value()
                 || providedAlphabet == SmppConstants.UNKNOWN_ALPHABET && determinedAlphabet == Alphabet.ALPHA_UCS2.value()) {
             // change charset to use multilang messages
-            return Charset.forName(SmppConstants.UCS2_ENCODING);
+            return StandardCharsets.UTF_16BE;
         }
 
         return defaultCharset;