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

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


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

commit 4d76f5e947bdc4f56e4b51fc5b1bcb42e4b025c0
Author: James Netherton <[email protected]>
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());
+                    }
+                }
             }
         }
 

Reply via email to