Skip to content

Commit 3896ef2

Browse files
committed
conductor-oss-fixDynamicForkIssue: Fix groovy testcase failure
1 parent 2a55004 commit 3896ef2

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinDynamicTaskMapper.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,23 @@ public List<TaskModel> getMappedTasks(TaskMapperContext taskMapperContext)
227227
}
228228

229229
for (TaskModel forkedTask : forkedTasks) {
230-
Map<String, Object> forkedTaskInput =
231-
tasksInput.get(forkedTask.getReferenceTaskName());
232-
if (forkedTask.getInputData() == null) {
233-
forkedTask.setInputData(new HashMap<>());
230+
try {
231+
Map<String, Object> forkedTaskInput =
232+
tasksInput.get(forkedTask.getReferenceTaskName());
233+
if (forkedTask.getInputData() == null) {
234+
forkedTask.setInputData(new HashMap<>());
235+
}
236+
if (forkedTaskInput == null) {
237+
forkedTaskInput = new HashMap<>();
238+
}
239+
forkedTask.getInputData().putAll(forkedTaskInput);
240+
} catch (Exception e) {
241+
String reason =
242+
String.format(
243+
"Tasks could not be dynamically forked due to invalid input: %s",
244+
e.getMessage());
245+
throw new TerminateWorkflowException(reason);
234246
}
235-
if (forkedTaskInput == null) {
236-
forkedTaskInput = new HashMap<>();
237-
}
238-
forkedTask.getInputData().putAll(forkedTaskInput);
239247
}
240248
mappedTasks.addAll(forkedTasks);
241249
// Get the last of the dynamic tasks so that the join can be performed once this

0 commit comments

Comments
 (0)