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

rxl pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit f62bc5bc4ef17c1688149e874251fca1e5309059
Author: Fernando Miguélez Palomo <fernando.migue...@gmail.com>
AuthorDate: Mon Jul 6 03:26:47 2020 +0200

    [Issue 7407] NPE with tombstones (#7408)
    
    Added check to prevent NPE when a tombstone (null value) is produced.
    
    Fixes #7407
    
    (cherry picked from commit 90c2f4ae8bb8fa405e69f0b2cf99622223bae6ab)
---
 .../java/org/apache/pulsar/client/impl/ConsumerStatsRecorderImpl.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerStatsRecorderImpl.java
 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerStatsRecorderImpl.java
index 80ee5f9..c1a2559 100644
--- 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerStatsRecorderImpl.java
+++ 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerStatsRecorderImpl.java
@@ -166,7 +166,7 @@ public class ConsumerStatsRecorderImpl implements 
ConsumerStatsRecorder {
     public void updateNumMsgsReceived(Message<?> message) {
         if (message != null) {
             numMsgsReceived.increment();
-            numBytesReceived.add(message.getData().length);
+            numBytesReceived.add(message.getData() == null ? 0 : 
message.getData().length);
         }
     }
 

Reply via email to