You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/05/19 22:25:40 UTC
[1/2] camel git commit: CAMEL-8782: Configuring endpoints using
reference lookup may fail with matching primitive types with their Object
counterpart types
Repository: camel
Updated Branches:
refs/heads/camel-2.14.x 96a6e4ec4 -> 8050e1e6d
refs/heads/camel-2.15.x a696a468c -> 568ce2b13
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/8050e1e6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8050e1e6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8050e1e6
Branch: refs/heads/camel-2.14.x
Commit: 8050e1e6dbcd1bdcc349fd2d7e051a7294b5dc7c
Parents: 96a6e4e
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 19 21:49:34 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 19 22:29:50 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/8050e1e6/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 98caa8e..f68a6be 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/>
@@ -501,16 +503,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);
[2/2] camel git commit: CAMEL-8782: Configuring endpoints using
reference lookup may fail with matching primitive types with their Object
counterpart types
Posted by da...@apache.org.
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 <da...@apache.org>
Authored: Tue May 19 21:49:34 2015 +0200
Committer: Claus Ibsen <da...@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);