This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch is in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4893416c29f77e3e990756fbf45b303801675b09 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Oct 14 10:02:20 2023 +0200 CAMEL-19988: camel-core - PropertyBindingSupport - Should not hide IllegalArgumentException with real cause if failing to set property --- .../org/apache/camel/impl/engine/IntrospectionSupport.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/IntrospectionSupport.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/IntrospectionSupport.java index 2b7dc7ffba3..23a3d014a88 100644 --- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/IntrospectionSupport.java +++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/IntrospectionSupport.java @@ -598,6 +598,7 @@ final class IntrospectionSupport { } } + boolean myself = false; try { try { // If the type is null or it matches the needed type, just use the value directly @@ -620,6 +621,8 @@ final class IntrospectionSupport { if ((parameterType == Boolean.class || parameterType == boolean.class) && ref instanceof String) { String val = (String) ref; if (!val.equalsIgnoreCase("true") && !val.equalsIgnoreCase("false")) { + // this is our self + myself = true; throw new IllegalArgumentException( "Cannot convert the String value: " + ref + " to type: " + parameterType + " as the value is not true or false"); @@ -650,7 +653,14 @@ final class IntrospectionSupport { } } // ignore exceptions as there could be another setter method where we could type convert successfully - } catch (SecurityException | NoTypeConversionAvailableException | IllegalArgumentException e) { + } catch (IllegalArgumentException e) { + // this can be either our own or while trying to set the property on the bean that fails in the 3rd party component + if (myself) { + typeConversionFailed = e; + } else { + throw e; + } + } catch (SecurityException | NoTypeConversionAvailableException e) { typeConversionFailed = e; }