This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-4.0.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.0.x by this push: new 8db922db357 CAMEL-19988: camel-core - PropertyBindingSupport - Should not hide IllegalArgumentException with real cause if failing to set property 8db922db357 is described below commit 8db922db357367a4688c96a4553037a3f38c502f 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 e175fe086a1..4383eb2def7 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 @@ -600,6 +600,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 @@ -622,6 +623,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"); @@ -652,7 +655,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; }