You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2021/01/06 22:20:39 UTC

[accumulo] branch main updated: Fix NPE in ZooTraceClient.sendSpans (#1857)

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

ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 2b3abc2  Fix NPE in ZooTraceClient.sendSpans (#1857)
2b3abc2 is described below

commit 2b3abc2a6e251451cb3c8a13c8a9b279235143c8
Author: BukrosSzabolcs <sz...@cloudera.com>
AuthorDate: Wed Jan 6 23:20:29 2021 +0100

    Fix NPE in ZooTraceClient.sendSpans (#1857)
    
    It's possible to call ZooTraceClient.sendSpans before the ZooTraceClient
    class variables would be initialized resulting in a NPE when checking
    hosts.isEmpty(). This fix adds a check for null on the hosts variable to
    avoid the NPE.
---
 .../tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java
index 7b01cfa..d28419c 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java
@@ -162,7 +162,7 @@ public class ZooTraceClient extends AsyncSpanReceiver<String,Client> implements
 
   @Override
   protected void sendSpans() {
-    if (hosts.isEmpty()) {
+    if (hosts == null || hosts.isEmpty()) {
       if (!sendQueue.isEmpty()) {
         log.error("No hosts to send data to, dropping queued spans");
         synchronized (sendQueue) {