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

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

GitHub user aldettinger opened a pull request:

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

    CAMEL-11178: default methods support in bean binding

    Actually, the management of default methods has already been added via [a 
previous 
commit](https://github.com/apache/camel/pull/1703/commits/0ddb6a7baf2e092304ec7644b655371bdac28cd5)
 on version 2.20.0-SNAPSHOT. I like such PR solving more than one ticket :)
    
    Please, check 
[CAMEL-11178](https://issues.apache.org/jira/browse/CAMEL-11178) out for more 
details.

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/1733.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 #1733
    
----
commit 1dc74cbf2588d3b6aba410f100620cd1b65bfec9
Author: aldettinger <[email protected]>
Date:   2017-06-01T14:38:55Z

    CAMEL-11178: Added a test to ensure that default methods are explicitly 
supported in bean binding

commit 4202044e7b6e5c069cabc1619f396900d0785d32
Author: aldettinger <[email protected]>
Date:   2017-06-01T15:23:01Z

    CAMEL-11178: Corrected a wrong variable renaming I've proposed once

----


> Default method on interface is invisible during Camel Simple evaluation
> -----------------------------------------------------------------------
>
>                 Key: CAMEL-11178
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11178
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.16.1
>            Reporter: Anton Sulim
>             Fix For: 2.20.0
>
>
> Issue can be reproduced with below unit test, I have not found it in tracker. 
> Essence: interface A has default method, interface B extends A, default 
> method is invisible during Simple language evaluation. 
> {code:java}
> import org.apache.camel.CamelContext;
> import org.apache.camel.Exchange;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.impl.DefaultCamelContext;
> import org.apache.camel.impl.DefaultExchange;
> import org.junit.Assert;
> import org.junit.Test;
> public class DefaultMethodIsInvisibleTest {
>     public static interface A {
>         public default String defaultMethod() {
>             return "default method result";
>         }
>     }
>     public static interface B extends A {
>     }
>     @Test
>     public void camelSimpleDoesNotSeeDefaultMethod() throws Exception {
>         CamelContext context = new DefaultCamelContext();
>         context.addRoutes(new RouteBuilder() {
>             public void configure() {
>                 
> from("direct:camelSimpleDoesNotSeeDefaultMethod").script().simple("${exchangeProperty.myObject.defaultMethod}");
>             }
>         });
>         context.start();
>         Exchange incomingExchange = new DefaultExchange(context);
>         incomingExchange.setProperty("myObject", new B() {
>         });
>         Exchange result = 
> context.createProducerTemplate().send("direct:camelSimpleDoesNotSeeDefaultMethod",
>  incomingExchange);
>         Assert.assertNull(result.getException());
>     }
> }
> {code}
> Stacktrace:
> {code}
> Caused by: org.apache.camel.language.bean.RuntimeBeanExpressionException: 
> Failed to invoke method: defaultMethod on null due to: 
> org.apache.camel.component.bean.MethodNotFoundException: Method with name: 
> defaultMethod not found on bean: 
> com.ubs.wma.gfi.tradersbook.subscriber.DefaultMethodIsInvisibleTest$2@5dafbe45
>  of type: 
> com.ubs.wma.gfi.tradersbook.subscriber.DefaultMethodIsInvisibleTest$2. 
> Exchange[][Message: [Body is null]]
>     at 
> org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:290)
>     at 
> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)
>     ... 46 common frames omitted
> Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method 
> with name: defaultMethod not found on bean: 
> com.ubs.wma.gfi.tradersbook.subscriber.DefaultMethodIsInvisibleTest$2@5dafbe45
>  of type: 
> com.ubs.wma.gfi.tradersbook.subscriber.DefaultMethodIsInvisibleTest$2. 
> Exchange[][Message: [Body is null]]
>     at 
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:269)
>     at 
> org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:183)
>     at 
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:159)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to