[ 
https://issues.apache.org/jira/browse/CAMEL-11511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16074088#comment-16074088
 ] 

ASF GitHub Bot commented on CAMEL-11511:
----------------------------------------

GitHub user aldettinger opened a pull request:

    https://github.com/apache/camel/pull/1804

    CAMEL-11511: Proposal to enhance the `BeanInfo` introspection in 2 cases

    Proposal to enhance the `BeanInfo` introspection in 2 cases:
    - A package private class implementing a 2 hop interface method
    - A public class implementing an interface method by an override from a 
package private class
    
    More info in 
[CAMEL-11511](https://issues.apache.org/jira/browse/CAMEL-11511).


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aldettinger/camel master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1804.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1804
    
----
commit 723a375e3a7f9c96659c30b5ae9504a4e1eabdbe
Author: aldettinger <aldettin...@gmail.com>
Date:   2017-07-04T20:14:35Z

    Corrected issues in BeanInfo introspection

commit 491f011f89dc7feccc282cfb5009956bbaf8d290
Author: aldettinger <aldettin...@gmail.com>
Date:   2017-06-29T16:26:48Z

    Implemented 2 tests showing issues in BeanInfo

----


> Camel bean binding issues
> -------------------------
>
>                 Key: CAMEL-11511
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11511
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Alex Dettinger
>            Priority: Minor
>
> Tests below show 2 issues in the bean binding:
> {code:java}
> public class PrivatePackageClassBeanInfoTest extends CamelTestSupport {
>     @EndpointInject(uri = "mock:result")
>     protected MockEndpoint mockResult;
>     public static interface IA {
>         public String method();
>     }
>     public static interface IB extends IA {
>         public String method1();
>     }
>     class C implements IB {
>         @Override
>         public String method() {
>             return "C.method() has been called";
>         }
>         @Override
>         public String method1() {
>             return "C.method1() has been called";
>         }
>     }
>     public static interface IBC {
>         public String method();
>     }
>     class D {
>         public String method() {
>             return "D.method() has been called";
>         }
>     }
>     public class E extends D implements IBC {
>     }
>     @Test
>     public void getInterfaceMethodsMessUpWithMultipleLevelOfInterface() 
> throws InterruptedException {
>         mockResult.expectedBodiesReceived("C.method() has been called");
>         template.sendBodyAndProperty("direct:test", "", "myObject", new C());
>         mockResult.assertIsSatisfied();
>     }
>     @Test
>     public void interfaceMethodImplementedByPackagePrivateUpperClassFails() 
> throws InterruptedException {
>         System.out.println(Modifier.isPublic(E.class.getModifiers()));
>         mockResult.expectedBodiesReceived("D.method() has been called");
>         template.sendBodyAndProperty("direct:test", "", "myObject", new E());
>         mockResult.assertIsSatisfied();
>     }
>     @Override
>     public RouteBuilder createRouteBuilder() {
>         return new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 
> from("direct:test").setBody(simple("${exchangeProperty.myObject.method}")).to(mockResult);
>             }
>         };
>     }
> }
> {code}
> Below messages are logged:
> {noformat}
> logged:org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed 
> to invoke method: method on null due to: 
> org.apache.camel.RuntimeExchangeException: IllegalAccessException occurred 
> invoking method: public java.lang.String 
> PrivatePackageClassBeanInfoTest$D.method() using arguments: [] on the 
> exchange: Exchange[]
> {noformat}
> {noformat}
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to 
> invoke method: method on null due to: 
> org.apache.camel.RuntimeExchangeException: IllegalAccessException occurred 
> invoking method: public java.lang.String 
> PrivatePackageClassBeanInfoTest$C.method() using arguments: [] on the 
> exchange: Exchange[]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to