camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: @ExchangeException does not always bind to the caught Exception
Date Tue, 19 May 2009 07:16:30 GMT
Hi Joe

I got it. I have reproduced an unit test demonstrating this issue.

I have created a ticket to track it:

Will commit a fix shortly.

On Tue, May 19, 2009 at 6:51 AM, Claus Ibsen <> wrote:
> Hi Joe
> Which version of Camel are you using precisely?
> I do think that we can improve @ExchangeException to be able to find
> the exception you want in the exception hierarchy.
> As for instance on trunk you can do:
> exchange.getException(JaxbException.class) and it will find that
> exception for you in the list of wrapped caused exceptions.
> So the same feature should apply for @ExchangeException.
> On Tue, May 19, 2009 at 2:21 AM, Joe Gottman <> wrote:
>> I have a Bean method
>> public String handleJaxbError( @ExchangeException JaxbException e)
>>  that is written to handle a thrown JaxbException and is only called inside
>> a doCatch(JaxbException) clause.  However, when the parameter e is of type
>> JaxbException, the value of e when the method is executed is null.  I have
>> to write the function as
>>                public String handleJaxbError(@ExchangeException Exception
>> e)
>> to get the caught Exception in the e variable.   The trouble is that the
>> Exception that was thrown was not a JaxbException.  It was an IOException
>> that returned a JaxbException when e.getCause() was called.  Even so, since
>> the doCatch(JaxbException.class) clause did catch this exception, it seems
>> to me that the JaxbException should bind to the @ExchangeException
>> annotation.  Or alternatively, we could have a @CaughtException annotation
>> that binds to the exception that was caught, and have @ExchangeException
>> continue to bind to the outermost Exception.
>> --
>> View this message in context:
>> Sent from the Camel Development mailing list archive at
> --
> Claus Ibsen
> Apache Camel Committer
> Open Source Integration:
> Blog:
> Twitter:

Claus Ibsen
Apache Camel Committer

Open Source Integration:

View raw message