Try Catch blocks get disrupted
onimurasame Jan 6, 2016 1:13 PMHello all!
Well this is my story.
I've been playing around with Jboss Developer Studio to make myself a nice Jboss Fuse project.
First I tried to make a simple Camel Route to consume from a queue transform the data using a Java bean then put it in another queue. As I managed to do that rather nicely, I began to put some exception handling inside my java bean and then the problem now I'm facing is that I can't seem to handle that in the camel route.
I searched around and I came with this answer:
< route > < from uri="direct:start"/> <!-- here the try starts. its a try .. catch .. finally just as regular java code --> < doTry > < process ref="processorFail"/> < to uri="mock:result"/> < doCatch > <!-- catch multiple exceptions --> < exception >java.io.IOException</ exception > < exception >java.lang.IllegalStateException</ exception > < to uri="mock:catch"/> </ doCatch > < doFinally > < to uri="mock:finally"/> </ doFinally > </ doTry > </ route > |
So after I nicely copied and pasted that into my camel route xml, the design looked like this:
But after I went back to the source view of the route it turned (broke?) into this:
<?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd"> <bean id="numericTransformation" class="com.test.javatransformator.NumericTransformation" /> <camelContext xmlns="http://camel.apache.org/schema/blueprint"> <route> <from uri="direct:start"/> <doTry> <process ref="processorFail"/> <to uri="mock:result"/> <doFinally> <to uri="mock:finally"/> </doFinally> </doTry> </route> </camelContext> </blueprint>
And when I went back to the Design view it looked like this:
And as you can see the catch is nowhere to be found and my route went kaput.
What I'm doing wrong?
PS: I'm using this version of Jboss Studio Version: 8.1.0.GA
Build id: GA-v20150327-1349-B467
Build date: 20150327-1349
Any help would be very much appreciated!