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

Wrong call from deprecated method org.apache.camel.util.IntrospectionSupport.extractProperties to new org.apache.camel.support.IntrospectionSupport.extractProperties leading to IllegalArgumentException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Information Provided
    • Affects Version/s: 3.2.0
    • Fix Version/s: None
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Using activemq 5.15.9 with camel 3.2.0 is leading to a IllegalArgumentException:

       

       

      Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: wrong number of argumentsCaused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: wrong number of arguments at org.apache.camel.util.IntrospectionSupport.extractProperties(IntrospectionSupport.java:41) at org.apache.activemq.camel.component.ActiveMQComponent.convertPathToActualDestination(ActiveMQComponent.java:161) at org.apache.camel.component.jms.JmsComponent.createEndpoint(JmsComponent.java:1081) at org.apache.camel.support.DefaultComponent.createEndpoint(DefaultComponent.java:233) at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:842) ... 53 moreCaused by: java.lang.IllegalArgumentException: wrong number of arguments at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... suppressed 3 lines at org.apache.camel.util.IntrospectionSupport.extractProperties(IntrospectionSupport.java:39) ... 57 more

       

      This is due to the dynamic invocation not being correctly implemented.

       

          @Deprecated
          public static Map<String, Object> extractProperties(Map<String, Object> properties, String optionPrefix) {
              try {
                  Class<?> clazz = Class.forName("org.apache.camel.support.IntrospectionSupport");
                  Method method = clazz.getMethod("extractProperties", Map.class, String.class);
                  return (Map) method.invoke(properties, optionPrefix);
              } catch (Throwable t) {
                  throw new RuntimeException(t);
              }
          }
      
      

      the invocation skipped the instance it needs to use to invoke the method from. The method is a static, so it should use a null instance.

       

       

          @Deprecated
          public static Map<String, Object> extractProperties(Map<String, Object> properties, String optionPrefix) {
              try {
                  Class<?> clazz = Class.forName("org.apache.camel.support.IntrospectionSupport");
                  Method method = clazz.getMethod("extractProperties", Map.class, String.class);
                  return (Map) method.invoke(null, properties, optionPrefix);
              } catch (Throwable t) {
                  throw new RuntimeException(t);
              }
          }
      
      

        

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tchass121 Vincent Grossi
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: