camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Re: Why does Bindy prohibit empty files?
Date Thu, 25 Sep 2014 09:39:42 GMT
Hi Charles,

I've created the requested ticket:
Thank you in advance.
I've implemented the onException() method already to log and handle other occurring exceptions
in that route. Therefore I'd like to avoid the IllegalArgumentException if possible.


Thank you for your suggestions. I will test them.

-----Urspr√ľngliche Nachricht-----
Gesendet: Wednesday, 24 September 2014 um 19:18:06 Uhr
Von: "Charles Moulliard" <>
Betreff: Re: Why does Bindy prohibit empty files?

We could certainly improve Bindy and implements what you suggest. Could you
please raise a ticket concerning your request ?

Until now, I suggest that you add a onException() to handle the exception
throws by Bindy when the data stream is empty


On Wed, Sep 24, 2014 at 5:36 PM, <> wrote:

> Prolog: Camel Bindy will throw an IllegalArgumentException if the current
> InputStream doesn't contain any data (see
> at line 174 and 200).
> I have the following scenario:
> An external program provides my program with csv files containing some
> data. My program grabs that data, fills in missing entries and writes
> everything to a storage. If the external program provides an empty file to
> signalize no new data, my program should still fill the missing data,
> because now every expected entry is missing.
> Currently I bypassed the exception of the unmarshal process with a choice
> and an expression to check the file length which is kind of unpleasant.
>         .choice().when(simple("${body.length} == 0"))
>           .setBody(constant(ImmutableList.of()))
>         .otherwise()
>           .unmarshal(format)
>           ....
> I know it is a good idea to check if any data is available at that stream,
> but why should that method throw an Exception instead of return an empty
> collection? The calling method could handle that if it wants to. Or if it
> is mandatory that the Exception gets thrown in the unmarshal method, then
> an additional annotation would be great to explicitly allow empty files to
> be parsed (and get an empty collection in return). Something like
> @CsvRecord(allowEmptyFiles = true).
> Thanks in advance for any feedback.

Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :

View raw message