Skip to content

Commit

Permalink
Refactor RuleItemChangedSubscriber ignore database name case avoid npe (
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaojinchao95 authored Jan 16, 2024
1 parent a308ac7 commit 9d21e57
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void renew(final AlterRuleItemEvent event) {
RuleItemConfigurationChangedProcessor processor = TypedSPILoader.getService(RuleItemConfigurationChangedProcessor.class, event.getType());
String yamlContent =
contextManager.getMetaDataContexts().getPersistService().getMetaDataVersionPersistService().getVersionPathByActiveVersion(event.getActiveVersionKey(), event.getActiveVersion());
ShardingSphereDatabase database = contextManager.getMetaDataContexts().getMetaData().getDatabases().get(event.getDatabaseName());
ShardingSphereDatabase database = contextManager.getMetaDataContexts().getMetaData().getDatabase(event.getDatabaseName());
RuleConfiguration currentRuleConfig = processor.findRuleConfiguration(database);
synchronized (this) {
processor.changeRuleItemConfiguration(event, currentRuleConfig, processor.swapRuleItemConfiguration(event, yamlContent));
Expand All @@ -71,7 +71,7 @@ public void renew(final DropRuleItemEvent event) {
return;
}
RuleItemConfigurationChangedProcessor processor = TypedSPILoader.getService(RuleItemConfigurationChangedProcessor.class, event.getType());
ShardingSphereDatabase database = contextManager.getMetaDataContexts().getMetaData().getDatabases().get(event.getDatabaseName());
ShardingSphereDatabase database = contextManager.getMetaDataContexts().getMetaData().getDatabase(event.getDatabaseName());
RuleConfiguration currentRuleConfig = processor.findRuleConfiguration(database);
synchronized (this) {
processor.dropRuleItemConfiguration(event, currentRuleConfig);
Expand Down

0 comments on commit 9d21e57

Please sign in to comment.