Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11511

Camel bean binding issues

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.20.0
    • camel-core
    • None
    • Unknown

    Description

      Tests below show 2 issues in the bean binding:

      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);
                  }
              };
          }
      }
      

      Below messages are logged:

      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[]
      
      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[]
      

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              aldettinger Alex Dettinger
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: