You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/08/25 07:10:34 UTC

[camel] branch camel-3.18.x updated: CAMEL-18423: Handle NoSuchElementException in CamelMicroProfilePropertiesSource.loadProperties with filter predicate

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

jamesnetherton pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.18.x by this push:
     new c97bac730e2 CAMEL-18423: Handle NoSuchElementException in CamelMicroProfilePropertiesSource.loadProperties with filter predicate
c97bac730e2 is described below

commit c97bac730e2ceb3feadefafc3609108c68db8c5a
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Aug 25 07:54:04 2022 +0100

    CAMEL-18423: Handle NoSuchElementException in CamelMicroProfilePropertiesSource.loadProperties with filter predicate
---
 .../microprofile/config/CamelMicroProfilePropertiesSource.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/components/camel-microprofile/camel-microprofile-config/src/main/java/org/apache/camel/component/microprofile/config/CamelMicroProfilePropertiesSource.java b/components/camel-microprofile/camel-microprofile-config/src/main/java/org/apache/camel/component/microprofile/config/CamelMicroProfilePropertiesSource.java
index 615d2688a9d..6fd85bae4c3 100644
--- a/components/camel-microprofile/camel-microprofile-config/src/main/java/org/apache/camel/component/microprofile/config/CamelMicroProfilePropertiesSource.java
+++ b/components/camel-microprofile/camel-microprofile-config/src/main/java/org/apache/camel/component/microprofile/config/CamelMicroProfilePropertiesSource.java
@@ -70,7 +70,13 @@ public class CamelMicroProfilePropertiesSource implements LoadablePropertiesSour
 
         for (String name : config.getPropertyNames()) {
             if (filter.test(name)) {
-                config.getOptionalValue(name, String.class).ifPresent(value -> answer.put(name, value));
+                try {
+                    config.getOptionalValue(name, String.class).ifPresent(value -> answer.put(name, value));
+                } catch (NoSuchElementException e) {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Failed to resolve property {} due to {}", name, e.getMessage());
+                    }
+                }
             }
         }