Merge pull request #1703 from metamx/fix-npe

add null check for task context.
This commit is contained in:
Charles Allen 2015-09-04 11:04:12 -07:00
commit 9b5889b393
1 changed files with 12 additions and 9 deletions

View File

@ -215,15 +215,18 @@ public class ForkingTaskRunner implements TaskRunner, TaskLogStreamer
} }
// Override task specific properties // Override task specific properties
for (String propName : task.getContext().keySet()) { final Map<String, Object> context = task.getContext();
if (propName.startsWith(CHILD_PROPERTY_PREFIX)) { if (context != null) {
command.add( for (String propName : context.keySet()) {
String.format( if (propName.startsWith(CHILD_PROPERTY_PREFIX)) {
"-D%s=%s", command.add(
propName.substring(CHILD_PROPERTY_PREFIX.length()), String.format(
task.getContextValue(propName) "-D%s=%s",
) propName.substring(CHILD_PROPERTY_PREFIX.length()),
); task.getContextValue(propName)
)
);
}
} }
} }