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

xyuanlu 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 d0708e1bb Add default get value for task partition map to prevent 
NPE(#3078)
d0708e1bb is described below

commit d0708e1bba20bbc62ff9132115d94900d50b0951
Author: Grant Paláu Spencer <[email protected]>
AuthorDate: Thu Nov 20 11:04:01 2025 -0800

    Add default get value for task partition map to prevent NPE(#3078)
    
    This PR fixes an NPE in task pipeline caused by a difference in map keyset. 
In fillActiveTaskCount(..) we iterate over the keyset of one map, but then call 
.get(key) on a 2nd map. This works on the assumption that the two maps will 
have the same keyset. The map we get the keys from is built from nodes with 
task current states and the other is from live and enabled nodes. If there is a 
node with a current state but has been disabled, then there will be key 
mismatch and a null value wil [...]
    This fix adds a default get value of 0 to both get operations to prevent 
any NPEs
---
 .../helix/controller/dataproviders/WorkflowControllerDataProvider.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/helix-core/src/main/java/org/apache/helix/controller/dataproviders/WorkflowControllerDataProvider.java
 
b/helix-core/src/main/java/org/apache/helix/controller/dataproviders/WorkflowControllerDataProvider.java
index 3a71e777b..52e27987f 100644
--- 
a/helix-core/src/main/java/org/apache/helix/controller/dataproviders/WorkflowControllerDataProvider.java
+++ 
b/helix-core/src/main/java/org/apache/helix/controller/dataproviders/WorkflowControllerDataProvider.java
@@ -189,7 +189,7 @@ public class WorkflowControllerDataProvider extends 
BaseControllerDataProvider {
       Map<String, Integer> partitionMap) {
     for (String participant : additionPartitionMap.keySet()) {
       partitionMap.put(participant,
-          partitionMap.get(participant) + 
additionPartitionMap.get(participant));
+          partitionMap.getOrDefault(participant, 0) + 
additionPartitionMap.getOrDefault(participant, 0));
     }
   }
 

Reply via email to