You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by hu...@apache.org on 2019/11/19 20:41:23 UTC

[helix] branch master updated: Fix NullPointerException and test failure for testDisablePartitionAndStopInstance. (#613)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a264841  Fix NullPointerException and test failure for testDisablePartitionAndStopInstance. (#613)
a264841 is described below

commit a264841cc2efcf1ffb58a4af6f5c0f60adb123b0
Author: Huizhi L <ih...@gmail.com>
AuthorDate: Tue Nov 19 12:41:16 2019 -0800

    Fix NullPointerException and test failure for testDisablePartitionAndStopInstance. (#613)
    
    StrictMatchExternalViewVerifier's toString() has a bug that causes NullPointerException if _resources is null. The code fails to check if _resources is null. And NullPointerException causes testDisablePartitionAndStopInstance's failure.
    
    Fix the bug by checking if _resources is null in StrictMatchExternalViewVerifier's toString().
---
 .../tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java      | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java b/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java
index 29b1c76..13cc260 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/ClusterVerifiers/StrictMatchExternalViewVerifier.java
@@ -298,7 +298,8 @@ public class StrictMatchExternalViewVerifier extends ZkHelixClusterVerifier {
   @Override
   public String toString() {
     String verifierName = getClass().getSimpleName();
-    return verifierName + "(" + _clusterName + "@" + _zkClient.getServers() + "@resources["
-        + _resources != null ? Arrays.toString(_resources.toArray()) : "" + "])";
+    return String
+        .format("%s(%s@%s@resources[%s])", verifierName, _clusterName, _zkClient.getServers(),
+            _resources != null ? Arrays.toString(_resources.toArray()) : "");
   }
 }