You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2021/11/05 14:18:39 UTC

[camel] branch main updated: [CAMEL-17128]MLLP charset is no longer overrridable from the HL7 message MSH 18 (#6389)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new eccd04c  [CAMEL-17128]MLLP charset is no longer overrridable from the HL7 message MSH 18 (#6389)
eccd04c is described below

commit eccd04cc966a09b4fd8f9f0be33dac9e2fa0754d
Author: Freeman(Yue) Fang <fr...@gmail.com>
AuthorDate: Fri Nov 5 10:17:13 2021 -0400

    [CAMEL-17128]MLLP charset is no longer overrridable from the HL7 message MSH 18 (#6389)
---
 .../camel/component/mllp/MllpCharsetHelper.java      | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpCharsetHelper.java b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpCharsetHelper.java
index 52e1538..b5b4fac 100644
--- a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpCharsetHelper.java
+++ b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpCharsetHelper.java
@@ -43,16 +43,6 @@ public final class MllpCharsetHelper {
     }
 
     public static Charset getCharset(Exchange exchange, byte[] hl7Bytes, Hl7Util hl7Util, Charset defaultCharset) {
-        String exchangeCharsetName = ExchangeHelper.getCharsetName(exchange, false);
-        if (exchangeCharsetName != null && !exchangeCharsetName.isEmpty()) {
-            try {
-                if (Charset.isSupported(exchangeCharsetName)) {
-                    return Charset.forName(exchangeCharsetName);
-                }
-            } catch (Exception charsetEx) {
-                // ignore
-            }
-        }
 
         String msh18 = hl7Util.findMsh18(hl7Bytes, defaultCharset);
         if (msh18 != null && !msh18.isEmpty()) {
@@ -68,6 +58,16 @@ public final class MllpCharsetHelper {
             }
         }
 
+        String exchangeCharsetName = ExchangeHelper.getCharsetName(exchange, false);
+        if (exchangeCharsetName != null && !exchangeCharsetName.isEmpty()) {
+            try {
+                if (Charset.isSupported(exchangeCharsetName)) {
+                    return Charset.forName(exchangeCharsetName);
+                }
+            } catch (Exception charsetEx) {
+                // ignore
+            }
+        }
         return defaultCharset;
     }