You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Minh Tran <da...@gmail.com> on 2016/05/29 23:40:26 UTC

bean binding regression bug

Hi

I’m seeing an unusual problem with bean binding when I upgraded from 2.17.0 to 2.17.1. 

I’ve simplified it to the following example

public interface IBar {
	Object load();
}

public interface IFoo extends IBar {
	Object fooLoad();
}

public class Foo implements IFoo {
	@Override
	public Integer load() {
		return 1;
	}

	@Override
	public Integer fooLoad() {
		return 2;
	}
}

The route is 

from(“direct:load”).to("bean:foo?method=load")
from(“direct:fooLoad”).to("bean:foo?method=fooLoad”)

When using 2.17.1, the first route fails with the following exception

org.apache.camel.component.bean.MethodNotFoundException: Method with name: load not found on bean: au.com.winning.camule.route.Foo@5627b8eb of type: au.com.winning.camule.route.Foo. Exchange[ID-minhmac-local-52639-1464564203123-0-2]
	at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:269) ~[camel-core-2.17.1.jar:2.17.1]
	at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:185) ~[camel-core-2.17.1.jar:2.17.1]
	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:159) ~[camel-core-2.17.1.jar:2.17.1]
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) [camel-core-2.17.1.jar:2.17.1]
	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:68) ~[camel-core-2.17.1.jar:2.17.1]
	at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:38) ~[camel-core-2.17.1.jar:2.17.1]


The second route passes and calls the method correctly.

When using 2.17.0, both routes call the methods successfully.

From debugging the camel source code in both versions, I think the problem lies in the BeanInfo.introspect method. 2.17.0 did an extra check on bridge methods but this is now missing in 2.17.1

// skip bridge methods in duplicate checks (as the bridge method is inserted by the compiler due to type erasure)
if (source.isBridge()) {
      continue;
}

It’s probably a combination of both using bridge methods and a complicated inheritance structure that is causing this bug. However it is a third party library I am interfacing against so I cannot simply change the code myself. I can probably get around it by writing an adapter but I’m not keen on it.




Re: bean binding regression bug

Posted by yogu13 <yo...@gmail.com>.
it was changed as part of CAMEL-9656, you can comment on the JIRA and check
the response.



--
View this message in context: http://camel.465427.n5.nabble.com/bean-binding-regression-bug-tp5783228p5783528.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: bean binding regression bug

Posted by Minh Tran <da...@gmail.com>.
Should I raise a jira? Thanks.

> On 30 May 2016, at 9:40 AM, Minh Tran <da...@gmail.com> wrote:
> 
> Hi
> 
> I’m seeing an unusual problem with bean binding when I upgraded from 2.17.0 to 2.17.1. 
> 
> I’ve simplified it to the following example
> 
> public interface IBar {
> 	Object load();
> }
> 
> public interface IFoo extends IBar {
> 	Object fooLoad();
> }
> 
> public class Foo implements IFoo {
> 	@Override
> 	public Integer load() {
> 		return 1;
> 	}
> 
> 	@Override
> 	public Integer fooLoad() {
> 		return 2;
> 	}
> }
> 
> The route is 
> 
> from(“direct:load”).to("bean:foo?method=load")
> from(“direct:fooLoad”).to("bean:foo?method=fooLoad”)
> 
> When using 2.17.1, the first route fails with the following exception
> 
> org.apache.camel.component.bean.MethodNotFoundException: Method with name: load not found on bean: au.com.winning.camule.route.Foo@5627b8eb of type: au.com.winning.camule.route.Foo. Exchange[ID-minhmac-local-52639-1464564203123-0-2]
> 	at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:269) ~[camel-core-2.17.1.jar:2.17.1]
> 	at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:185) ~[camel-core-2.17.1.jar:2.17.1]
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:159) ~[camel-core-2.17.1.jar:2.17.1]
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) [camel-core-2.17.1.jar:2.17.1]
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:68) ~[camel-core-2.17.1.jar:2.17.1]
> 	at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:38) ~[camel-core-2.17.1.jar:2.17.1]
> 
> 
> The second route passes and calls the method correctly.
> 
> When using 2.17.0, both routes call the methods successfully.
> 
> From debugging the camel source code in both versions, I think the problem lies in the BeanInfo.introspect method. 2.17.0 did an extra check on bridge methods but this is now missing in 2.17.1
> 
> // skip bridge methods in duplicate checks (as the bridge method is inserted by the compiler due to type erasure)
> if (source.isBridge()) {
>      continue;
> }
> 
> It’s probably a combination of both using bridge methods and a complicated inheritance structure that is causing this bug. However it is a third party library I am interfacing against so I cannot simply change the code myself. I can probably get around it by writing an adapter but I’m not keen on it.
> 
> 
>