Kamil created CAMEL-13536:
-----------------------------
Summary: StackOverflow when using bean(this)
Key: CAMEL-13536
URL: https://issues.apache.org/jira/browse/CAMEL-13536
Project: Camel
Issue Type: Bug
Reporter: Kamil
This testcase
{code:java}
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.AdviceWithRouteBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class MyRouteTest extends CamelTestSupport {
private static final String ROUTE_ID = "mytest";
@Override
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:mytest")
.id(ROUTE_ID)
.bean(this, "hello", false) // <- here is the problem
.to("stream:out");
}
public void hello(final Exchange exchange) {
}
};
}
@Override
public void setUp() throws Exception {
super.setUp();
final CamelContext camelContext = context();
camelContext.getRouteDefinition(ROUTE_ID)
.adviceWith(camelContext, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
weaveAddLast().to("mock:extract");
}
});
}
@Override
public boolean isUseAdviceWith() {
return true;
}
@Test
public void shouldFire() throws InterruptedException {
// given
final MockEndpoint myMock = getMockEndpoint("mock:extract");
myMock.expectedMessageCount(1);
// when
template.sendBody("direct:mytest", "test");
// then
myMock.assertIsSatisfied();
}
}
{code}
Throws
{code:java}
java.lang.StackOverflowError
at java.util.AbstractCollection.toString(Unknown Source)
at java.lang.String.valueOf(Unknown Source)
at java.lang.StringBuilder.append(Unknown Source)
at org.apache.camel.model.RoutesDefinition.toString(RoutesDefinition.java:64)
at org.apache.camel.builder.RouteBuilder.toString(RouteBuilder.java:74)
at org.apache.camel.model.BeanDefinition.description(BeanDefinition.java:89)
at org.apache.camel.model.BeanDefinition.toString(BeanDefinition.java:78)
at java.lang.String.valueOf(Unknown Source)
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)