You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/07/18 06:49:37 UTC

[camel] 07/07: CAMEL-12659: Don't log error message when HL7 Headers population is disabled

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

acosentino pushed a commit to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1b6b6a961edcf915964bf5bb1a55c98463e446ca
Author: Quinn Stevenson <qu...@apache.org>
AuthorDate: Tue Jul 17 11:18:12 2018 -0600

    CAMEL-12659: Don't log error message when HL7 Headers population is disabled
---
 .../apache/camel/component/mllp/MllpTcpServerConsumer.java    | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

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 dcd32d8..030fa47 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
@@ -290,7 +290,7 @@ public class MllpTcpServerConsumer extends DefaultConsumer {
 
 
     void populateHl7DataHeaders(Exchange exchange, Message message, byte[] hl7MessageBytes) {
-        if (exchange != null && exchange.getException() == null) {
+        if (getConfiguration().isHl7Headers() && exchange != null && exchange.getException() == null) {
             if (hl7MessageBytes == null || hl7MessageBytes.length < 8) {
                 // Not enough data to populate anything - just return
                 return;
@@ -315,8 +315,8 @@ public class MllpTcpServerConsumer extends DefaultConsumer {
 
             if (-1 == endOfMSH) {
                 // TODO:  May want to throw some sort of an Exception here
-                log.error("Population of message headers failed - unable to find the end of the MSH segment");
-            } else if (getConfiguration().isHl7Headers()) {
+                log.warn("Population of message headers failed - unable to find the end of the MSH segment");
+            } else {
                 log.debug("Populating the HL7 message headers");
                 Charset charset = getConfiguration().getCharset(exchange);
 
@@ -384,10 +384,11 @@ public class MllpTcpServerConsumer extends DefaultConsumer {
                         }
                     }
                 }
-            } else {
-                log.trace("HL7 Message headers disabled");
             }
+        } else {
+            log.trace("HL7 Message headers disabled");
         }
+
     }