This is an automated email from the ASF dual-hosted git repository. jianglongtao pushed a commit to branch fix-33341 in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
commit 4da6141c5af04e98f7709310ed8ced3e08145f1a Author: RaigorJiang <[email protected]> AuthorDate: Wed Jul 10 11:24:33 2024 +0800 Pick #31514, Fix NPE when import metadata --- .../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 a7e11a424de..f03f5368f3f 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 259856b2819..1cee2a0bedb 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 @@ -100,7 +100,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(); }
