You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2024/06/28 16:39:27 UTC

(shardingsphere) branch master updated: Add null check on YamlProxyConfigurationSwapper (#31917)

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

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 143f115f09e Add null check on YamlProxyConfigurationSwapper (#31917)
143f115f09e is described below

commit 143f115f09e99807526eb2b1588fbdcf00aa07ff
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Jun 29 00:39:21 2024 +0800

    Add null check on YamlProxyConfigurationSwapper (#31917)
---
 .../backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
index 8fd6efdf7ab..94ddfbce4b8 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
@@ -34,9 +34,11 @@ import org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyServerConfig
 
 import javax.sql.DataSource;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Properties;
 import java.util.stream.Collectors;
 
 /**
@@ -63,7 +65,8 @@ public final class YamlProxyConfigurationSwapper {
     private ProxyGlobalConfiguration swapGlobalConfiguration(final YamlProxyServerConfiguration yamlConfig) {
         Map<String, DataSource> dataSources = swapDataSources(yamlConfig.getDataSources());
         Collection<RuleConfiguration> ruleConfigs = ruleConfigSwapperEngine.swapToRuleConfigurations(yamlConfig.getRules());
-        return new ProxyGlobalConfiguration(dataSources, ruleConfigs, yamlConfig.getProps(), yamlConfig.getLabels());
+        return new ProxyGlobalConfiguration(dataSources, ruleConfigs,
+                null == yamlConfig.getProps() ? new Properties() : yamlConfig.getProps(), null == yamlConfig.getLabels() ? Collections.emptyList() : yamlConfig.getLabels());
     }
     
     private Map<String, DataSource> swapDataSources(final Map<String, YamlProxyDataSourceConfiguration> yamlDataSourceConfigs) {