MONIR: Check for NULL in case of version probing
In case of version probing we would skip the logic for setting cluster / assigned tasks; since these values are initialized as null they are vulnerable to NPE when code changes.
Reviewers: A. Sophie Blee-Goldman Bill Bejeck
@@ -112,7 +112,7 @@ public class TaskManager {
}
private void addStreamTasks(final Collection<TopicPartition> assignment) {
- if (assignedActiveTasks.isEmpty()) {
+ if (assignedActiveTasks == null || assignedActiveTasks.isEmpty()) {
return;
}
final Map<TaskId, Set<TopicPartition>> newTasks = new HashMap<>();
@@ -151,8 +151,7 @@ public class TaskManager {
}
private void addStandbyTasks() {
- final Map<TaskId, Set<TopicPartition>> assignedStandbyTasks = this.assignedStandbyTasks;
- if (assignedStandbyTasks.isEmpty()) {
+ if (assignedStandbyTasks == null || assignedStandbyTasks.isEmpty()) {
return;
}
log.debug("Adding assigned standby tasks {}", assignedStandbyTasks);
