You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2021/07/28 03:23:38 UTC

[GitHub] [incubator-shenyu] YXxy1002 commented on a change in pull request #1815: fix: NPE when refreshURIService

YXxy1002 commented on a change in pull request #1815:
URL: https://github.com/apache/incubator-shenyu/pull/1815#discussion_r677944322



##########
File path: shenyu-register-center/shenyu-register-server/shenyu-register-server-nacos/src/main/java/org/apache/shenyu/register/server/nacos/NacosServerRegisterRepository.java
##########
@@ -165,7 +165,11 @@ private void publishMetadata(final String data) {
     }
 
     private void refreshURIService(final RpcTypeEnum rpcType, final String serviceName) {
-        for (String contextPath: uriServiceCache.get(serviceName)) {
+        ConcurrentSkipListSet<String> services = uriServiceCache.get(serviceName);
+        if (services == null) {

Review comment:
       maybe in this way?
   `
   ConcurrentSkipListSet<String> services = uriServiceCache.get(serviceName);
           Optional.ofNullable(services).ifPresent(data -> {
               for (String contextPath : data) {
                   registerURI(contextPath, serviceName, rpcType);
               }
   });
   `




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org