camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A.Light" <>
Subject GenericFileMessage creates body from file multiples times
Date Wed, 01 Apr 2015 09:01:39 GMT
Hi all,
using the file component I encountered a behaviour that doesn't seem right
to me... but maybe it's an intended behaviour.

Basically the issue shows when I have a route that reads the contents of a
file using the file component and then the message body goes to null. At
this point, any subsequent call to "getBody" (for instance a log("${body})
will cause the file to be read again, and put in the body.

This behaviour is caused by the GenericFileMessage method "createBody()"
(invoked by the MessageSupport.getBody() when the body is null) that, for
the sake of lazy file loading, loads the file again every time it is

This means that I cannot have an empty body, for any reason, in a route
initiated by a file component. This seems wrong to me as null body can have
valid meaning in a camel route. 
It this an intended behaviour?

I created a test class for this issue that you can get here:
<>  .
Let me know if you have problems getting it.


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

View raw message