From ed359ea32a316efc4685c9ff169b05e6b121ae93 Mon Sep 17 00:00:00 2001 From: bfrc Date: Tue, 2 Jul 2024 15:24:18 +0800 Subject: [PATCH 1/2] Update RegistryProtocol.java fix NPE in unregister --- .../apache/dubbo/registry/integration/RegistryProtocol.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java index f05b8bdd94a..50708639952 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java @@ -1104,7 +1104,8 @@ public synchronized void unregister() { .getConfiguration() .convert(Boolean.class, ENABLE_CONFIGURATION_LISTEN, true)) { for (ModuleModel moduleModel : applicationModel.getPubModuleModels()) { - if (!moduleModel + if (null != moduleModel.getServiceRepository() + && !moduleModel .getServiceRepository() .getExportedServices() .isEmpty()) { From 3138e1ea29c52c43fd6568348ca940f62d399b35 Mon Sep 17 00:00:00 2001 From: shibin Date: Tue, 2 Jul 2024 17:00:07 +0800 Subject: [PATCH 2/2] formating --- .../dubbo/registry/integration/RegistryProtocol.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java index 50708639952..991323af573 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java @@ -1105,10 +1105,10 @@ public synchronized void unregister() { .convert(Boolean.class, ENABLE_CONFIGURATION_LISTEN, true)) { for (ModuleModel moduleModel : applicationModel.getPubModuleModels()) { if (null != moduleModel.getServiceRepository() - && !moduleModel - .getServiceRepository() - .getExportedServices() - .isEmpty()) { + && !moduleModel + .getServiceRepository() + .getExportedServices() + .isEmpty()) { moduleModel .getExtensionLoader(GovernanceRuleRepository.class) .getDefaultExtension()