Skip to content

Commit

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

fixes elastic#51153
  • Loading branch information
Hendrik Muhs authored and SivagurunathanV committed Jan 21, 2020
1 parent d607690 commit 9c85060
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 9c85060

Please sign in to comment.