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.



Reply via email to