You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ts...@apache.org on 2020/07/13 08:23:07 UTC
[dubbo] branch master updated: Fix NPE when unexport Metadata
Service (#6450)
This is an automated email from the ASF dual-hosted git repository.
tswstarplanet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new a2e5102 Fix NPE when unexport Metadata Service (#6450)
a2e5102 is described below
commit a2e5102657a8abe03812f0b025f457ca3d994921
Author: tswstarplanet <ts...@apache.org>
AuthorDate: Mon Jul 13 16:22:42 2020 +0800
Fix NPE when unexport Metadata Service (#6450)
---
.../java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
index 4af2dbc..6985980 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
@@ -74,6 +74,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.CompletableFuture;
@@ -1005,10 +1006,10 @@ public class DubboBootstrap extends GenericEventListener {
}
private void unexportMetadataService() {
- metadataServiceExporters
- .stream()
- .filter(this::supports)
- .forEach(MetadataServiceExporter::unexport);
+ Optional.ofNullable(metadataServiceExporters)
+ .ifPresent(set -> set.stream()
+ .filter(this::supports)
+ .forEach(MetadataServiceExporter::unexport));
}
private boolean supports(MetadataServiceExporter exporter) {