Here is a small project. I hope it is understandable. I don't know JIRA
well enough to create a ticket.
http://www.nabble.com/file/p23577706/uncompressTest.7z uncompressTest.7z
Here's the relevant part of the route:
.doTry()
.unmarshal(new JaxbDataFormat("camel.unmarshal.test"))
.doCatch(Exception.class)
// .transform().constant(JaxbExceptionHandler.errorMessage) //This
works.
.bean(JaxbExceptionHandler.class, "handleError") //This fails,
even though
the bean is called
.end()
When I called the .bean method (or the .setBody() method) after catching
an unmarshal exception, the results were not saved. On the other hand,
calling transform() worked for some reason.
Claus Ibsen-2 wrote:
>
> Hi
>
> Can you create a small project or unit test demonstrating this?
> And if so please create a JIRA ticket and attach the sample project.
>
> Then we have a good head start to investigate, and see what the problem
> is.
>
> In the mean time you are welcome to try with 2.0-SNAPSHOT to see if
> the problem still exists.
> Instructions on the Camel download page, how to get it.
>
>
> On Tue, May 12, 2009 at 2:55 PM, Joe Gottman <[email protected]>
> wrote:
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Tue, May 12, 2009 at 2:13 AM, Joe Gottman <[email protected]>
>>> wrote:
>>>
>>> Can you show the route DSL how you do this? You should generally use
>>> handled(true) to clear the exception.
>>> Or use doTry() .. doCatch() just as you would use try .. catch in normal
>>> Java
>>> http://camel.apache.org/try-catch-finally.html
>>>
>>> Or if you use a processor, you should be able to do
>>> exchange.setException(null) to clear the exception.
>>>
>>>
>>>
>>
>>
>> onException(JAXBException.class)
>> .handled(true)
>> .bean(CamelErrorHandler.class, "handleJaxbError")
>> .to("log:XML?level=ERROR&showBodyType=false");
>>
>> Where CamelErrorHandler is a class I wrote and
>> CamelErrorHandler.handleJaxbError() takes a parameter of type
>> JAXBException.
>> We use @Property("CamelExceptionCaught") to bind the Exception to the
>> parameter. I can replace the .bean() step with a .setBody("Hello
>> World"),
>> and still the original exception stack trace is output to the log. I
>> know
>> that the handleJaxbError function is being called because I can set a
>> breakpoint in it.
>> --
>> View this message in context:
>> http://www.nabble.com/Handling-Exception-from-marshal-unmarshal-tp23494097p23502031.html
>> Sent from the Camel Development mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
> Interview with me:
> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>
>
--
View this message in context:
http://www.nabble.com/Handling-Exception-from-marshal-unmarshal-tp23494097p23577706.html
Sent from the Camel Development mailing list archive at Nabble.com.