helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject [2/4] helix git commit: Fix NPE exception in CurrentStateOutput when getting currentstate for a task.
Date Mon, 16 Apr 2018 18:24:19 GMT
Fix NPE exception in CurrentStateOutput when getting currentstate for a task.


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/47d790e0
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/47d790e0
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/47d790e0

Branch: refs/heads/master
Commit: 47d790e0c6ac388ee38b829bbc9311d21d001705
Parents: 13fac7c
Author: Lei Xia <lxia@linkedin.com>
Authored: Tue Apr 3 14:01:07 2018 -0700
Committer: Lei Xia <lxia@linkedin.com>
Committed: Mon Apr 16 11:22:40 2018 -0700

----------------------------------------------------------------------
 .../helix/controller/stages/CurrentStateOutput.java     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/47d790e0/helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateOutput.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateOutput.java
b/helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateOutput.java
index ce0880e..4ebef97 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateOutput.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateOutput.java
@@ -373,9 +373,15 @@ public class CurrentStateOutput {
             if (!currentPartitionCount.containsKey(participant)) {
               currentPartitionCount.put(participant, 0);
             }
-            String currState = participantMap.getValue().toString();
-            if (participantMap.getValue() instanceof Message) {
-              currState = ((Message) participantMap.getValue()).getToState();
+
+            Object curStateObj = participantMap.getValue();
+            String currState = null;
+            if (curStateObj != null) {
+              if (curStateObj instanceof Message) {
+                currState = ((Message) curStateObj).getToState();
+              } else if (curStateObj instanceof String) {
+                currState = curStateObj.toString();
+              }
             }
             if ((currState != null && currState.equals(state)) || (currState == null
&& state == null)) {
               currentPartitionCount.put(participant, currentPartitionCount.get(participant)
+ 1);


Mime
View raw message