From ec6eb6b7765c2faa157b0ecd7cd69cf81f21219b Mon Sep 17 00:00:00 2001 From: tristaZero Date: Thu, 19 Jul 2018 17:45:43 +0800 Subject: [PATCH] modify SpringMasterSlaveDataSource constructor. --- .../spring/datasource/SpringMasterSlaveDataSource.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/jdbc/orchestration/spring/datasource/SpringMasterSlaveDataSource.java b/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/jdbc/orchestration/spring/datasource/SpringMasterSlaveDataSource.java index d63eb281c800a..aa56c70a75ec4 100644 --- a/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/jdbc/orchestration/spring/datasource/SpringMasterSlaveDataSource.java +++ b/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/jdbc/orchestration/spring/datasource/SpringMasterSlaveDataSource.java @@ -25,6 +25,7 @@ import javax.sql.DataSource; import java.sql.SQLException; import java.util.Collection; +import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; @@ -38,13 +39,15 @@ public class SpringMasterSlaveDataSource extends MasterSlaveDataSource { public SpringMasterSlaveDataSource(final Map dataSourceMap, final String name, final String masterDataSourceName, final Collection slaveDataSourceNames, final MasterSlaveLoadBalanceAlgorithm strategy, final Map configMap, final Properties props) throws SQLException { - super(dataSourceMap, getMasterSlaveRuleConfiguration(name, masterDataSourceName, slaveDataSourceNames, strategy), configMap, props); + super(dataSourceMap, getMasterSlaveRuleConfiguration(name, masterDataSourceName, slaveDataSourceNames, strategy), + null == configMap ? new LinkedHashMap() : configMap, null == props ? new Properties() : props); } public SpringMasterSlaveDataSource(final Map dataSourceMap, final String name, final String masterDataSourceName, final Collection slaveDataSourceNames, final MasterSlaveLoadBalanceAlgorithmType strategyType, final Map configMap, final Properties props) throws SQLException { super(dataSourceMap, - getMasterSlaveRuleConfiguration(name, masterDataSourceName, slaveDataSourceNames, null == strategyType ? null : strategyType.getAlgorithm()), configMap, props); + getMasterSlaveRuleConfiguration(name, masterDataSourceName, slaveDataSourceNames, null == strategyType ? null : strategyType.getAlgorithm()), + null == configMap ? new LinkedHashMap() : configMap, null == props ? new Properties() : props); } private static MasterSlaveRuleConfiguration getMasterSlaveRuleConfiguration(