You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by co...@apache.org on 2020/07/14 10:16:51 UTC

[camel] branch master updated: Use Pattern.quote in mllp instead of using manual escaping

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 593162d  Use Pattern.quote in mllp instead of using manual escaping
593162d is described below

commit 593162dfaa353f81889a547ebab1f70b5555fd29
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue Jul 14 11:16:00 2020 +0100

    Use Pattern.quote in mllp instead of using manual escaping
---
 .../java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
index d1314a4..96583f9 100644
--- a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
+++ b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
@@ -33,6 +33,7 @@ import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
@@ -374,7 +375,7 @@ public class MllpTcpServerConsumer extends DefaultConsumer {
                         if (i == 8) {
                             // final byte componentSeparator = hl7MessageBytes[4];
                             String componentSeparator = new String(hl7MessageBytes, 4, 1, charset);
-                            String[] components = headerValue.split(String.format("\\Q%s\\E", componentSeparator), 3);
+                            String[] components = headerValue.split(Pattern.quote(componentSeparator), 3);
                             message.setHeader(MllpConstants.MLLP_EVENT_TYPE, components[0]);
                             if (2 <= components.length) {
                                 message.setHeader(MllpConstants.MLLP_TRIGGER_EVENT, components[1]);