Skip to content

Commit

Permalink
check custom meta data to avoid NPE (#51163)
Browse files Browse the repository at this point in the history
check custom meta data to avoid NPE, fixes a problem introduced in #51072

fixes #51153
  • Loading branch information
Hendrik Muhs committed Jan 20, 2020
1 parent f7d827d commit 57a70ed
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,16 @@ static Tuple<Set<String>, Set<String>> findTasksWithoutConfig(ClusterState state
Set<String> taskIds = new HashSet<>();
Set<String> executorNodes = new HashSet<>();

Predicate<PersistentTask<?>> taskMatcher = Strings.isAllOrWildcard(new String[] { transformId }) ? t -> true : t -> {
TransformTaskParams transformParams = (TransformTaskParams) t.getParams();
return Regex.simpleMatch(transformId, transformParams.getId());
};

for (PersistentTasksCustomMetaData.PersistentTask<?> pTask : tasks.findTasks(TransformField.TASK_NAME, taskMatcher)) {
executorNodes.add(pTask.getExecutorNode());
taskIds.add(pTask.getId());
if (tasks != null) {
Predicate<PersistentTask<?>> taskMatcher = Strings.isAllOrWildcard(new String[] { transformId }) ? t -> true : t -> {
TransformTaskParams transformParams = (TransformTaskParams) t.getParams();
return Regex.simpleMatch(transformId, transformParams.getId());
};

for (PersistentTasksCustomMetaData.PersistentTask<?> pTask : tasks.findTasks(TransformField.TASK_NAME, taskMatcher)) {
executorNodes.add(pTask.getExecutorNode());
taskIds.add(pTask.getId());
}
}

return new Tuple<>(taskIds, executorNodes);
Expand Down

0 comments on commit 57a70ed

Please sign in to comment.