Commit d0708e1
authored
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 will be returned, which we then attempt to perform arithmetic on (+ operator) and get an NPE. Interestingly, this can only occur after a controller reset as it needs the 2nd map keys to be cleared and repopulated without the disabled node.
This fix adds a default get value of 0 to both get operations to prevent any NPEs1 parent 3d50967 commit d0708e1
File tree
1 file changed
+1
-1
lines changed- helix-core/src/main/java/org/apache/helix/controller/dataproviders
1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
0 commit comments