camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-8782: Configuring endpoints using reference lookup may fail with matching primitive types with their Object counterpart types
Date Tue, 19 May 2015 20:25:41 GMT
CAMEL-8782: Configuring endpoints using reference lookup may fail with matching primitive types
with their Object counterpart types


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/568ce2b1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/568ce2b1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/568ce2b1

Branch: refs/heads/camel-2.15.x
Commit: 568ce2b13ebe9c67627f8f0e403e9ac49b60c742
Parents: a696a46
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue May 19 21:49:34 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue May 19 22:30:00 2015 +0200

----------------------------------------------------------------------
 .../org/apache/camel/util/IntrospectionSupport.java     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/568ce2b1/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java b/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
index d04c310..13ceba9 100755
--- a/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
@@ -43,6 +43,8 @@ import org.apache.camel.TypeConverter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.util.ObjectHelper.isAssignableFrom;
+
 /**
  * Helper for introspections of beans.
  * <p/>
@@ -502,16 +504,20 @@ public final class IntrospectionSupport {
                 if (ref == null) {
                     // try the next method if nothing was found
                     continue;
-                } else if (!parameterType.isAssignableFrom(ref.getClass())) {
+                } else {
                     // setter method has not the correct type
-                    continue;
+                    // (must use ObjectHelper.isAssignableFrom which takes primitive types
into account)
+                    boolean assignable = isAssignableFrom(parameterType, ref.getClass());
+                    if (!assignable) {
+                        continue;
+                    }
                 }
             }
 
             try {
                 try {
                     // If the type is null or it matches the needed type, just use the value
directly
-                    if (value == null || parameterType.isAssignableFrom(ref.getClass()))
{
+                    if (value == null || isAssignableFrom(parameterType, ref.getClass()))
{
                         // we may want to set options on classes that has package view visibility,
so override the accessible
                         setter.setAccessible(true);
                         setter.invoke(target, ref);


Mime
View raw message