add null check for task context.

make variable final
This commit is contained in:
Nishant 2015-09-04 21:39:36 +05:30
parent 75a582974b
commit 47aac991ec
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
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)
)
);
}
}
}