Skip to content

Commit

Permalink
Fix NPE when import metadata (#31514)
Browse files Browse the repository at this point in the history
  • Loading branch information
yx9o authored Jun 2, 2024
1 parent f7d7ce2 commit 99d935d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ private String generatePropsData(final Properties props) {
}
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();
}

Expand Down

0 comments on commit 99d935d

Please sign in to comment.