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

zhaojinchao 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 5836cec6d56 Fix the exception that the Resource display can be empty 
(#18408)
5836cec6d56 is described below

commit 5836cec6d56e3e7f2a400d79078283db99e5ec09
Author: lanchengx <[email protected]>
AuthorDate: Fri Jun 17 15:32:31 2022 +0800

    Fix the exception that the Resource display can be empty (#18408)
---
 .../common/queryable/ShowReadwriteSplittingReadResourcesHandler.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowReadwriteSplittingReadResourcesHandler.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowReadwriteSplittingReadResourcesHandler.java
index e7497982687..3d262e94622 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowReadwriteSplittingReadResourcesHandler.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowReadwriteSplittingReadResourcesHandler.java
@@ -92,7 +92,7 @@ public final class ShowReadwriteSplittingReadResourcesHandler 
extends QueryableR
                 .filter(each -> new 
RuleExportEngine(each).containExportableKey(exportKeys)).findFirst().map(each 
-> new 
RuleExportEngine(each).export(exportKeys)).orElse(Collections.emptyMap());
         Map<String, Map<String, String>> allReadwriteRuleMap = 
exportMap.values().stream().map(each -> ((Map<String, Map<String, String>>) 
each).entrySet())
                 
.flatMap(Collection::stream).collect(Collectors.toMap(Entry::getKey, 
Entry::getValue, (v1, v2) -> v2, LinkedHashMap::new));
-        return allReadwriteRuleMap.values().stream().map(each -> 
each.getOrDefault(ExportableItemConstants.REPLICA_DATA_SOURCE_NAMES, ""))
+        return allReadwriteRuleMap.values().stream().map(each -> 
each.get(ExportableItemConstants.REPLICA_DATA_SOURCE_NAMES)).filter(each -> 
null != each && !each.isEmpty())
                 
.map(this::deconstructString).flatMap(Collection::stream).collect(Collectors.toCollection(LinkedHashSet::new));
     }
     

Reply via email to