Hi

Yes unfortunately the bug is the 1.4.0 release.

I have added it to known issues in the release notes, with a workaround:
http://activemq.apache.org/camel/camel-140-release.html (currently only showing 
for tracer but the same workaround applies)

It is of course fixed in the next 1.5 release (work in progress)


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: raulvk.soa [mailto:[EMAIL PROTECTED] 
Sent: 23. september 2008 12:59
To: [email protected]
Subject: Bug in LogFormatter.getBodyTypeAsString


Hi,

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
java.lang.NullPointerException
        at
org.apache.camel.component.log.LogFormatter.getBodyTypeAsString(LogFormatter.java:167)
        at
org.apache.camel.component.log.LogFormatter.format(LogFormatter.java:56)
        at org.apache.camel.processor.Logger.logMessage(Logger.java:218)
        at org.apache.camel.processor.Logger.process(Logger.java:88)
        ................

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".

Cheers.
-- 
View this message in context: 
http://www.nabble.com/Bug-in-LogFormatter.getBodyTypeAsString-tp19625342s22882p19625342.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to