You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2018/12/04 01:59:06 UTC

[pulsar] branch master updated: Exception Handling for Null Pointer Exception in BrokerService (#3108)

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

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new c60cf47  Exception Handling for Null Pointer Exception in BrokerService (#3108)
c60cf47 is described below

commit c60cf47b9928feca31eef294df2fd0228469c8ca
Author: Richard Yu <yo...@gmail.com>
AuthorDate: Mon Dec 3 17:59:01 2018 -0800

    Exception Handling for Null Pointer Exception in BrokerService (#3108)
    
    ### Motivation
    In a unit test under pulsar-broker, I have found that some NullPointerExceptions were thrown, although the tests had passed. I decided it will be best if we minimized the number of such exceptions as they are usually not intentionally thrown.
    
    ### Result
    The NullPointerException will no longer occur.
---
 .../src/main/java/org/apache/pulsar/broker/service/BrokerService.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
index 725ee93..16352a4 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
@@ -427,7 +427,7 @@ public class BrokerService implements Closeable, ZooKeeperCacheListener<Policies
     public void unloadNamespaceBundlesGracefully() {
         try {
             // make broker-node unavailable from the cluster
-            if (pulsar.getLoadManager() != null) {
+            if (pulsar.getLoadManager() != null && pulsar.getLoadManager().get() != null) {
                 try {
                     pulsar.getLoadManager().get().disableBroker();
                 } catch (PulsarServerException.NotFoundException ne) {