You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2018/11/02 07:00:39 UTC

[incubator-skywalking] branch master updated: avoid NPE. (#1869)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 76e4c59  avoid NPE. (#1869)
76e4c59 is described below

commit 76e4c5996d42e2219501e958d3ff7542dfb45daa
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Fri Nov 2 15:00:33 2018 +0800

    avoid NPE. (#1869)
---
 .../receiver/mesh/ServiceMeshMetricDataDecorator.java  | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/ServiceMeshMetricDataDecorator.java b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/ServiceMeshMetricDataDecorator.java
index 3dae80d..8e8a87b 100644
--- a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/ServiceMeshMetricDataDecorator.java
+++ b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/ServiceMeshMetricDataDecorator.java
@@ -85,21 +85,23 @@ public class ServiceMeshMetricDataDecorator {
             }
         }
         String endpoint = origin.getEndpoint();
-        if (destServiceId != Const.NONE) {
-            DetectPoint point = origin.getDetectPoint();
 
-            if (DetectPoint.client.equals(point)) {
+        DetectPoint point = origin.getDetectPoint();
+        if (DetectPoint.client.equals(point)) {
+            if (sourceServiceId != Const.NONE) {
                 endpointId = CoreRegisterLinker.getEndpointInventoryRegister().getOrCreate(sourceServiceId, endpoint,
                     org.apache.skywalking.oap.server.core.source.DetectPoint.fromMeshDetectPoint(point));
-            } else {
+            }
+        } else {
+            if (destServiceId != Const.NONE) {
                 endpointId = CoreRegisterLinker.getEndpointInventoryRegister().getOrCreate(destServiceId, endpoint,
                     org.apache.skywalking.oap.server.core.source.DetectPoint.fromMeshDetectPoint(point));
             }
+        }
 
-            if (endpointId != Const.NONE) {
-            } else {
-                isRegistered = false;
-            }
+        if (endpointId != Const.NONE) {
+        } else {
+            isRegistered = false;
         }
 
         return isRegistered;