Vincent Grossi created CAMEL-15321:
--------------------------------------
Summary: Wrong call from deprecated method
org.apache.camel.util.IntrospectionSupport.extractProperties to new
org.apache.camel.support.IntrospectionSupport.extractProperties
Key: CAMEL-15321
URL: https://issues.apache.org/jira/browse/CAMEL-15321
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 3.2.0
Reporter: Vincent Grossi
Fix For: 3.2.0
Using activemq 5.15.9 with camel 3.2.0 is leading to a IllegalArgumentException:
{noformat}
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{noformat}
This is due to the dynamic invocation not being correctly implemented.
{code:java}
@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);
}
}
{code}
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.
{code:java}
@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);
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)