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 2024/10/29 19:40:29 UTC
(camel) branch fb created (now 5f38f6a038a)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch fb
in repository https://gitbox.apache.org/repos/asf/camel.git
at 5f38f6a038a CAMEL-21401: camel-core - Custom bean in DSL using factory method should avoid ClassCastException
This branch includes the following new commits:
new 5f38f6a038a CAMEL-21401: camel-core - Custom bean in DSL using factory method should avoid ClassCastException
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(camel) 01/01: CAMEL-21401: camel-core - Custom bean in DSL using factory method should avoid ClassCastException
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch fb
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5f38f6a038a6018d221a37bdeb4166caadec9a25
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 29 20:09:06 2024 +0100
CAMEL-21401: camel-core - Custom bean in DSL using factory method should avoid ClassCastException
---
.../main/java/org/apache/camel/support/PropertyBindingSupport.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
index 121611361c6..bef39e9a43f 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
@@ -1578,7 +1578,7 @@ public final class PropertyBindingSupport {
}
Class<?> type = camelContext.getClassResolver().resolveMandatoryClass(className);
if (factoryMethod != null) {
- Class<?> factoryClass = null;
+ Class<?> factoryClass;
String typeOrRef = StringHelper.before(factoryMethod, ":");
if (typeOrRef != null) {
// use another class with factory method
@@ -1590,6 +1590,10 @@ public final class PropertyBindingSupport {
} else {
factoryClass = camelContext.getClassResolver().resolveMandatoryClass(typeOrRef);
}
+ } else {
+ // no specific factory class given so we need to use the bean type for that
+ factoryClass = type;
+ type = Object.class;
}
if (parameters != null) {
Class<?> target = factoryClass != null ? factoryClass : type;