You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2023/01/29 06:10:20 UTC

[servicecomb-java-chassis] branch 2.8.x updated: [SCB-2752] Filter out configurations with empty values (#3587)

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

liubao pushed a commit to branch 2.8.x
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/2.8.x by this push:
     new 6298aa5c4 [SCB-2752] Filter out configurations with empty values (#3587)
6298aa5c4 is described below

commit 6298aa5c4a2074d5c34ae3b956ee7b6c04bd777b
Author: yanghao <73...@users.noreply.github.com>
AuthorDate: Sun Jan 29 10:50:18 2023 +0800

    [SCB-2752] Filter out configurations with empty values (#3587)
---
 .../apache/servicecomb/core/ConfigurationSpringInitializer.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java b/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
index 790b48af6..791c441f7 100644
--- a/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
+++ b/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
@@ -329,7 +329,12 @@ public class ConfigurationSpringInitializer extends PropertySourcesPlaceholderCo
       EnumerablePropertySource<?> enumerablePropertySource = (EnumerablePropertySource<?>) propertySource;
       for (String propertyName : enumerablePropertySource.getPropertyNames()) {
         try {
-          configFromSpringBoot.put(propertyName, environment.getProperty(propertyName, Object.class));
+          Object propertyValue = environment.getProperty(propertyName, Object.class);
+          if (propertyValue == null) {
+            LOGGER.error("The value of a configuration item is null, please check whether there is any impact, config item key: {}", propertyName);
+            continue;
+          }
+          configFromSpringBoot.put(propertyName, propertyValue);
         } catch (Exception e) {
           throw new RuntimeException(
               "set up spring property source failed.If you still want to start up the application and ignore errors, you can set servicecomb.config.ignoreResolveFailure to true.",