Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE when import metadata #31514

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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