You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Răzvan Ludvig <ra...@almazsa.com> on 2012/02/20 15:54:45 UTC

Splitter ignores exception handling

Hello.

When running the attached unit test, I get the following (shortened)
stack trace, and the test fails with an error (not a failure). Using a
regular (non-streaming) splitter is enough to make the test pass.

Is this normal behaviour ?
Is the streaming splitter redundant, in the case of a "streaming" body
(like in the test, an iterator) ? The documentation
(http://camel.apache.org/splitter.html) would suggest otherwise.

org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message:
camel.test.SplitExceptionHandlingTest$1@1041876]
	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1212)
	at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:509)
	at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:442)
	at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:438)
	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:126)
	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:342)
	at camel.test.SplitExceptionHandlingTest.testDuplicateIdFailure(SplitExceptionHandlingTest.java:47)
        ...
Caused by: java.lang.RuntimeException: Uhoh.
	at camel.test.SplitExceptionHandlingTest$1.next(SplitExceptionHandlingTest.java:56)
	at camel.test.SplitExceptionHandlingTest$1.next(SplitExceptionHandlingTest.java:1)
	at org.apache.camel.processor.Splitter$1$1.next(Splitter.java:158)
	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:504)
	at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:219)
	at org.apache.camel.processor.Splitter.process(Splitter.java:97)
	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122)
	at org.apache.camel.processor.SubUnitOfWorkProcessor.process(SubUnitOfWorkProcessor.java:59)
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
        ...

Cheers!
Răzvan Ludvig

Re: Splitter ignores exception handling

Posted by "razvan.ludvig" <ra...@almazsa.com>.
http://camel.465427.n5.nabble.com/file/n5499403/SplitExceptionHandlingTest.java
SplitExceptionHandlingTest.java 


--
View this message in context: http://camel.465427.n5.nabble.com/Splitter-ignores-exception-handling-tp5499381p5499403.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Splitter ignores exception handling

Posted by Willem Jiang <wi...@gmail.com>.
Don't worry. I just resolved mine as duplication.

On Tue Feb 21 23:33:08 2012, razvan.ludvig wrote:
> I had also created a JIRA just earlier:
> https://issues.apache.org/jira/browse/CAMEL-5024
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Streaming-splitter-ignores-exception-handling-tp5501036p5502526.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 


Re: Splitter ignores exception handling

Posted by "razvan.ludvig" <ra...@almazsa.com>.
I had also created a JIRA just earlier:
https://issues.apache.org/jira/browse/CAMEL-5024

--
View this message in context: http://camel.465427.n5.nabble.com/Streaming-splitter-ignores-exception-handling-tp5501036p5502526.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Splitter ignores exception handling

Posted by Willem Jiang <wi...@gmail.com>.
I can reproduce the issue and just created a JIRA[1] for it.
I will commit the patch shortly if the tests are going well.

[1]https://issues.apache.org/jira/browse/CAMEL-5025


On Tue Feb 21 16:51:39 2012, razvan.ludvig wrote:
>
> Willem.Jiang wrote
>>
>> Can you remove the
>> 			onException(Exception.class).handled(true).end().
>>
>> from your route ?
>>
>
> It doesn't change anything. In fact, neither a global, nor a local (route)
> exception handling seem to be working. Here is the minimal route that still
> exhibits the issue, while removing the "streaming()" line will make the test
> pass.
>
>
> 					
> Cheers!
> Răzvan Ludvig
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Splitter-ignores-exception-handling-tp5501036p5501601.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 


Re: Splitter ignores exception handling

Posted by "razvan.ludvig" <ra...@almazsa.com>.
Willem.Jiang wrote
> 
> Can you remove the
> 			onException(Exception.class).handled(true).end().
> 
> from your route ?
> 

It doesn't change anything. In fact, neither a global, nor a local (route)
exception handling seem to be working. Here is the minimal route that still
exhibits the issue, while removing the "streaming()" line will make the test
pass.


					
Cheers!
Răzvan Ludvig 


--
View this message in context: http://camel.465427.n5.nabble.com/Splitter-ignores-exception-handling-tp5501036p5501601.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Splitter ignores exception handling

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

Can you remove the
			onException(Exception.class).handled(true).end().

from your route ?

On 2/20/12 11:24 PM, Răzvan Ludvig wrote:
> Hello.
>
> When running the attached unit test, I get the following (shortened)
> stack trace, and the test fails with an error (not a failure). Using a
> regular (non-streaming) splitter is enough to make the test pass.
>
> Is this normal behaviour ?
> Is the streaming splitter redundant, in the case of a "streaming" body
> (like in the test, an iterator) ? The documentation
> (http://camel.apache.org/splitter.html) would suggest otherwise.
>
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[Message:
> camel.test.SplitExceptionHandlingTest$1@1041876]
>         at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1212)
>         at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:509)
>         at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:442)
>         at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:438)
>         at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:126)
>         at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:342)
>         at camel.test.SplitExceptionHandlingTest.testDuplicateIdFailure(SplitExceptionHandlingTest.java:47)
>         ...
> Caused by: java.lang.RuntimeException: Uhoh.
>         at camel.test.SplitExceptionHandlingTest$1.next(SplitExceptionHandlingTest.java:56)
>         at camel.test.SplitExceptionHandlingTest$1.next(SplitExceptionHandlingTest.java:1)
>         at org.apache.camel.processor.Splitter$1$1.next(Splitter.java:158)
>         at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:504)
>         at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:219)
>         at org.apache.camel.processor.Splitter.process(Splitter.java:97)
>         at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122)
>         at org.apache.camel.processor.SubUnitOfWorkProcessor.process(SubUnitOfWorkProcessor.java:59)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
>         ...
>
> Cheers!
> Răzvan Ludvig


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Splitter ignores exception handling

Posted by Răzvan Ludvig <ra...@almazsa.com>.
Hello.

When running the attached unit test, I get the following (shortened)
stack trace, and the test fails with an error (not a failure). Using a
regular (non-streaming) splitter is enough to make the test pass.

Is this normal behaviour ?
Is the streaming splitter redundant, in the case of a "streaming" body
(like in the test, an iterator) ? The documentation
(http://camel.apache.org/splitter.html) would suggest otherwise.

org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message:
camel.test.SplitExceptionHandlingTest$1@1041876]
       at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1212)
       at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:509)
       at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:442)
       at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:438)
       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:126)
       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:342)
       at camel.test.SplitExceptionHandlingTest.testDuplicateIdFailure(SplitExceptionHandlingTest.java:47)
       ...
Caused by: java.lang.RuntimeException: Uhoh.
       at camel.test.SplitExceptionHandlingTest$1.next(SplitExceptionHandlingTest.java:56)
       at camel.test.SplitExceptionHandlingTest$1.next(SplitExceptionHandlingTest.java:1)
       at org.apache.camel.processor.Splitter$1$1.next(Splitter.java:158)
       at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:504)
       at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:219)
       at org.apache.camel.processor.Splitter.process(Splitter.java:97)
       at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122)
       at org.apache.camel.processor.SubUnitOfWorkProcessor.process(SubUnitOfWorkProcessor.java:59)
       at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
       at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
       at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
       at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
       ...

Cheers!
Răzvan Ludvig