Skip to content

Commit

Permalink
Merge pull request apache#1703 from metamx/fix-npe
Browse files Browse the repository at this point in the history
add null check for task context.
  • Loading branch information
drcrallen committed Sep 4, 2015
2 parents 75a5829 + 47aac99 commit 9b5889b
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,18 @@ public TaskStatus call()
}

// Override task specific properties
for (String propName : task.getContext().keySet()) {
if (propName.startsWith(CHILD_PROPERTY_PREFIX)) {
command.add(
String.format(
"-D%s=%s",
propName.substring(CHILD_PROPERTY_PREFIX.length()),
task.getContextValue(propName)
)
);
final Map<String, Object> context = task.getContext();
if (context != null) {
for (String propName : context.keySet()) {
if (propName.startsWith(CHILD_PROPERTY_PREFIX)) {
command.add(
String.format(
"-D%s=%s",
propName.substring(CHILD_PROPERTY_PREFIX.length()),
task.getContextValue(propName)
)
);
}
}
}

Expand Down

0 comments on commit 9b5889b

Please sign in to comment.