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 2023/08/23 15:00:17 UTC

[camel] 01/03: CAMEL-19784: camel-core - PropertyBindingSupport - mandatory reference should fail if cannot resolve bean

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch fixes
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1c1586dce9ee926a77fa98ed1d496041a5579470
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Aug 23 16:49:08 2023 +0200

    CAMEL-19784: camel-core - PropertyBindingSupport - mandatory reference should fail if cannot resolve bean
---
 .../main/java/org/apache/camel/support/PropertyBindingSupport.java    | 4 ++++
 1 file changed, 4 insertions(+)

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 1b2f7ee6d84..67d0a8179f4 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
@@ -542,6 +542,10 @@ public final class PropertyBindingSupport {
                 // resolve property placeholders
                 str = camelContext.resolvePropertyPlaceholders(str.toString());
             }
+            if (str == null && reference && mandatory && !optional) {
+                // we could not resolve the reference and this is mandatory
+                throw new PropertyBindingException(target, key, value);
+            }
             value = str;
         } catch (Exception e) {
             // report the exception using the long key and parent target