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 2019/04/05 01:52:39 UTC

[incubator-skywalking] branch master updated: Fix RabbitMq NPE case (#2450)

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 ea566b1  Fix RabbitMq NPE case (#2450)
ea566b1 is described below

commit ea566b19a501b44c29ca4083c28c560160ad86cf
Author: 于玉桔 <76...@qq.com>
AuthorDate: Fri Apr 5 09:52:33 2019 +0800

    Fix RabbitMq NPE case (#2450)
    
    * Fix npe
---
 .../skywalking/apm/plugin/rabbitmq/RabbitMQConsumerInterceptor.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/apm-sniffer/apm-sdk-plugin/rabbitmq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rabbitmq/RabbitMQConsumerInterceptor.java b/apm-sniffer/apm-sdk-plugin/rabbitmq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rabbitmq/RabbitMQConsumerInterceptor.java
index 2132fa3..91be8bb 100644
--- a/apm-sniffer/apm-sdk-plugin/rabbitmq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rabbitmq/RabbitMQConsumerInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/rabbitmq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rabbitmq/RabbitMQConsumerInterceptor.java
@@ -51,7 +51,11 @@ public class RabbitMQConsumerInterceptor implements InstanceMethodsAroundInterce
         CarrierItem next = contextCarrier.items();
         while (next.hasNext()) {
             next = next.next();
-            next.setHeadValue(properties.getHeaders().get(next.getHeadKey()).toString());
+            if (properties.getHeaders() != null && properties.getHeaders().get(next.getHeadKey()) != null) {
+                next.setHeadValue(properties.getHeaders().get(next.getHeadKey()).toString());
+            } else {
+                next.setHeadValue("");
+            }
         }
         ContextManager.extract(contextCarrier);