camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "raulvk.soa" <>
Subject Bug in LogFormatter.getBodyTypeAsString
Date Tue, 23 Sep 2008 10:58:41 GMT


Sometimes, the "in" message of an exchange can be null. I have come across
such case when communicating over a JBI endpoint, and during the processing
within ServiceMix an internal error occurs. JBI returns a null "out" message
on an InOut exchange, and Camel's Pipeline takes this null "out" message and
sets it as the new "in" message, thus effectively setting the "in" message
as null.

If the next endpoint is a Log component, this is what happens:

11:48:29,396 | ERROR - org.apache.camel.processor.Logger - Failed delivery
for exchangeId: ID-XXX-B624E47AF0/4985-1222164544269/0-172. On delivery
attempt: 5 caught: java.lang.NullPointerException
        at org.apache.camel.processor.Logger.logMessage(
        at org.apache.camel.processor.Logger.process(

I believe that logging methods should be non-intrusive, so we should first
check whether variables are null before accessing them, as it is not
acceptable for a logging task to interrupt the pipeline. In this case, my
suggestion is that if BodyType == null, then just print the string
"BodyType: null".

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message