camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilopanj <jerry.nap...@iteamsolutions.com>
Subject Camel 2.9.0 -- StackOverflowError initializing route with otherwise() clause
Date Fri, 30 Dec 2011 17:45:06 GMT
Hi,

I'm preparing to upgrade an application to 2.9.0 from 2.8.3 and found a
problem initializing one of our existing routes defined with the Java DSL:

from ("direct:outerRoute")
		.choice ()
		    .when(header("test-header").isNotNull())
		    	.to("direct:mainProcess")
		    .otherwise ()
		    	.to ("log:badMessage")
		    	.transform ()
		    		.method (rejectBean, "processRejectedMessage")
		 .end ();

I get a StackOverflowError initializing the route when using version 2.9.0
in the staging repo, but it works fine with version 2.8.3.  Here's a snippet
of the error below:

Exception in thread "SpringOsgiExtenderThread-27"
java.lang.StackOverflowError
	at java.lang.Integer.toHexString(Integer.java:174)
	at java.lang.Object.toString(Object.java:219)
	at
org.apache.camel.model.BeanDefinition.description(BeanDefinition.java:80)
	at org.apache.camel.model.BeanDefinition.toString(BeanDefinition.java:69)
	at java.lang.String.valueOf(String.java:2826)
	at java.lang.StringBuilder.append(StringBuilder.java:115)
	at java.util.AbstractCollection.toString(AbstractCollection.java:422)
	at java.lang.String.valueOf(String.java:2826)
	at java.lang.StringBuilder.append(StringBuilder.java:115)
	at
org.apache.camel.model.RouteDefinition.toString(RouteDefinition.java:116)
	at java.lang.String.valueOf(String.java:2826)
	at java.lang.StringBuilder.append(StringBuilder.java:115)
	at java.util.AbstractCollection.toString(AbstractCollection.java:422)
	at java.lang.String.valueOf(String.java:2826)
	at java.lang.StringBuilder.append(StringBuilder.java:115)
	at
org.apache.camel.model.RoutesDefinition.toString(RoutesDefinition.java:60)
	at org.apache.camel.builder.RouteBuilder.toString(RouteBuilder.java:58)
	at
org.apache.camel.language.bean.BeanExpression.toString(BeanExpression.java:68)
	at
org.apache.camel.model.language.ExpressionDefinition.toString(ExpressionDefinition.java:99)
	at java.lang.String.valueOf(String.java:2826)
	at java.lang.StringBuilder.append(StringBuilder.java:115)
	at
org.apache.camel.model.TransformDefinition.toString(TransformDefinition.java:44)
... etc ...

I can work around the problem by factoring the otherwise() portion into a
separate route:

from ("direct:handleBadMessage")
    .to ("log:badMessage")
    .transform ()
	.method (rejectBean, "processRejectedMessage");

from ("direct:outerRoute")
		.choice ()
		    .when(header("test-header").isNotNull())
		    	.to("direct:mainProcess")
		    .otherwise ()
		    	.to("direct:handleBadMessage")
		 .end ();

Thanks,
Jerry
 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-9-0-StackOverflowError-initializing-route-with-otherwise-clause-tp5110599p5110599.html
Sent from the Camel Development mailing list archive at Nabble.com.

Mime
View raw message