You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by jo...@apache.org on 2023/02/14 07:45:43 UTC

[incubator-eventmesh] branch master updated: [ISSUE #3105] Check for NPE (#3132)

This is an automated email from the ASF dual-hosted git repository.

jonyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 04827e1bf [ISSUE #3105] Check for NPE (#3132)
04827e1bf is described below

commit 04827e1bf80e20cbb5c8f91fb74b0a6a87c929c8
Author: dingrui <16...@qq.com>
AuthorDate: Tue Feb 14 15:45:36 2023 +0800

    [ISSUE #3105] Check for NPE (#3132)
    
    * [ISSUE #3105] Check for NPE
    
    * [ISSUE #3105] Code style detect
---
 .../registry/zookeeper/service/ZookeeperRegistryService.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/eventmesh-registry-plugin/eventmesh-registry-zookeeper/src/main/java/org/apache/eventmesh/registry/zookeeper/service/ZookeeperRegistryService.java b/eventmesh-registry-plugin/eventmesh-registry-zookeeper/src/main/java/org/apache/eventmesh/registry/zookeeper/service/ZookeeperRegistryService.java
index d63161d09..28f526a95 100644
--- a/eventmesh-registry-plugin/eventmesh-registry-zookeeper/src/main/java/org/apache/eventmesh/registry/zookeeper/service/ZookeeperRegistryService.java
+++ b/eventmesh-registry-plugin/eventmesh-registry-zookeeper/src/main/java/org/apache/eventmesh/registry/zookeeper/service/ZookeeperRegistryService.java
@@ -155,7 +155,8 @@ public class ZookeeperRegistryService implements RegistryService {
                     EventMeshInstance eventMeshInstance = JsonUtils.parseObject(new String(data, StandardCharsets.UTF_8), EventMeshInstance.class);
 
                     EventMeshDataInfo eventMeshDataInfo =
-                        new EventMeshDataInfo(clusterName, serviceName, endpoint, stat.getMtime(), eventMeshInstance.getMetaData());
+                        new EventMeshDataInfo(clusterName, serviceName, endpoint, stat.getMtime(),
+                            Objects.requireNonNull(eventMeshInstance, "instance must not be Null").getMetaData());
 
                     eventMeshDataInfoList.add(eventMeshDataInfo);
                 }
@@ -203,7 +204,8 @@ public class ZookeeperRegistryService implements RegistryService {
                     EventMeshInstance eventMeshInstance = JsonUtils.parseObject(new String(data, StandardCharsets.UTF_8), EventMeshInstance.class);
 
                     EventMeshDataInfo eventMeshDataInfo =
-                        new EventMeshDataInfo(clusterName, serviceName, endpoint, stat.getMtime(), eventMeshInstance.getMetaData());
+                        new EventMeshDataInfo(clusterName, serviceName, endpoint, stat.getMtime(),
+                            Objects.requireNonNull(eventMeshInstance, "instance must not be Null").getMetaData());
 
                     eventMeshDataInfoList.add(eventMeshDataInfo);
                 }
@@ -256,7 +258,8 @@ public class ZookeeperRegistryService implements RegistryService {
                 .orSetData()
                 .creatingParentsIfNeeded()
                 .withMode(CreateMode.EPHEMERAL)
-                .forPath(path, JsonUtils.toJSONString(eventMeshInstance).getBytes(StandardCharsets.UTF_8));
+                .forPath(path,
+                    Objects.requireNonNull(JsonUtils.toJSONString(eventMeshInstance), "instance must not be Null").getBytes(StandardCharsets.UTF_8));
 
             eventMeshRegisterInfoMap.put(eventMeshName, eventMeshRegisterInfo);
         } catch (Exception e) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org