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

[camel] branch camel-2.21.x updated: 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.

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


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
     new 9d8f7c6  CAMEL-12659: Don't log error message when HL7 Headers population is disabled
9d8f7c6 is described below

commit 9d8f7c662562f17ad9d0282fbfae7fb585fd4d11
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 06136f7..f3b5578 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
@@ -291,7 +291,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;
@@ -316,8 +316,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);
 
@@ -385,10 +385,11 @@ public class MllpTcpServerConsumer extends DefaultConsumer {
                         }
                     }
                 }
-            } else {
-                log.trace("HL7 Message headers disabled");
             }
+        } else {
+            log.trace("HL7 Message headers disabled");
         }
+
     }