This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 99d935d4479 Fix NPE when import metadata (#31514)
99d935d4479 is described below
commit 99d935d4479065efa322ca4ba5fda0de19be4013
Author: yx9o <[email protected]>
AuthorDate: Sun Jun 2 22:05:12 2024 +0800
Fix NPE when import metadata (#31514)
---
.../infra/config/rule/checker/RuleConfigurationCheckEngine.java | 4 ++++
.../handler/distsql/ral/queryable/ExportMetaDataExecutor.java | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java
index 99644c691b3..59eba9b0827 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java
@@ -49,6 +49,10 @@ public final class RuleConfigurationCheckEngine {
@SuppressWarnings({"unchecked", "rawtypes"})
public static void check(final RuleConfiguration ruleConfig, final
ShardingSphereDatabase database) {
RuleConfigurationChecker checker =
OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class,
Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass());
+ if (null == checker) {
+ // TODO Remove after implementing the checker of
BroadcastRuleConfiguration and SingleRuleConfiguration
+ return;
+ }
Collection<String> requiredDataSourceNames =
checker.getRequiredDataSourceNames(ruleConfig);
if (!requiredDataSourceNames.isEmpty()) {
checkDataSourcesExisted(database, requiredDataSourceNames);
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java
index 321dce1b34c..f1547677e7f 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java
@@ -101,7 +101,11 @@ public final class ExportMetaDataExecutor implements
DistSQLQueryExecutor<Export
}
StringBuilder result = new StringBuilder();
result.append("props:").append(System.lineSeparator());
- props.forEach((key, value) -> result.append("
").append(key).append(": ").append(value).append(System.lineSeparator()));
+ props.forEach((key, value) -> {
+ if (null != value && !"".equals(value)) {
+ result.append(" ").append(key).append(":
").append(value).append(System.lineSeparator());
+ }
+ });
return result.toString();
}