Author: davsclaus
Date: Mon Sep 24 09:01:25 2012
New Revision: 1389251

URL: http://svn.apache.org/viewvc?rev=1389251&view=rev
Log:
CAMEL-5644: Bean component - Should use try conversion when choosing method 
based on parameter type matching.

Modified:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java?rev=1389251&r1=1389250&r2=1389251&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
 Mon Sep 24 09:01:25 2012
@@ -52,8 +52,6 @@ import org.apache.camel.util.ObjectHelpe
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.camel.util.ExchangeHelper.convertToType;
-
 /**
  * Represents the metadata about a bean type created via a combination of
  * introspection and annotations together with some useful sensible defaults
@@ -571,8 +569,9 @@ public class BeanInfo {
                 if (methodInfo.getBodyParameterType().isInstance(body)) {
                     return methodInfo;
                 }
-                
-                Object value = convertToType(exchange, 
methodInfo.getBodyParameterType(), body);
+
+                // we should only try to convert, as we are looking for best 
match
+                Object value = 
exchange.getContext().getTypeConverter().tryConvertTo(methodInfo.getBodyParameterType(),
 exchange, body);
                 if (value != null) {
                     if (LOG.isTraceEnabled()) {
                         LOG.trace("Converted body from: {} to: {}",


Reply via email to