Buggy code:
public class WorkflowManagerImpl implements WorkflowManager , WorkflowAdmin { private final Logger log = LoggerFactory . getLogger ( getClass ( ) ) ; private final CuratorFramework curator ; private final String instanceName ; private final List < QueueConsumer > consumers ; private final SchedulerSelector schedulerSelector ; private final AtomicReference < WorkflowManagerImpl . State > state = new AtomicReference < > ( WorkflowManagerImpl . State . LATENT ) ; private final Serializer serializer ; private static final TaskType nullTaskType = new TaskType ( "" , "" , false ) ; private enum State { LATENT , STARTED , CLOSED ; } public WorkflowManagerImpl ( CuratorFramework curator , QueueFactory queueFactory , String instanceName , List < TaskExecutorSpec > specs , AutoCleanerHolder autoCleanerHolder , Serializer serializer ) { } public CuratorFramework getCurator ( ) { } @ VisibleForTesting volatile boolean debugDontStartConsumers = false ; @ Override public void start ( ) { } @ VisibleForTesting void startQueueConsumers ( ) { } @ Override public WorkflowListenerManager newWorkflowListenerManager ( ) { } @ Override public RunId submitTask ( Task task ) { } @ Override public Map < TaskId , TaskDetails > getTaskDetails ( RunId runId ) { } @ Override public RunId submitSubTask ( RunId parentRunId , Task task ) { } public void updateTaskProgress ( RunId runId , TaskId taskId , short progress ) { } @ Override public boolean cancelRun ( RunId runId ) { } @ Override public Optional < TaskExecutionResult > getTaskExecutionResult ( RunId runId , TaskId taskId ) { } public String getInstanceName ( ) { } @ Override public void close ( ) throws IOException { } @ Override public WorkflowAdmin getAdmin ( ) { } @ Override public boolean clean ( RunId runId ) { } @ Override public RunInfo getRunInfo ( RunId runId ) { } @ Override public List < RunInfo > getRunInfo ( ) { } @ Override public List < TaskInfo > getTaskInfo ( RunId runId ) { List < TaskInfo > taskInfos = Lists . newArrayList ( ) ; String startedTasksParentPath = ZooKeeperConstants . getStartedTasksParentPath ( ) ; String completedTaskParentPath = ZooKeeperConstants . getCompletedTaskParentPath ( ) ; try { String runPath = ZooKeeperConstants . getRunPath ( runId ) ; byte [ ] runBytes = curator . getData ( ) . forPath ( runPath ) ; RunnableTask runnableTask = serializer . deserialize ( runBytes , RunnableTask . class ) ; Set < TaskId > notStartedTasks = runnableTask . getTasks ( ) . values ( ) . stream ( ) . filter ( ExecutableTask :: isExecutable ) . map ( ExecutableTask :: getTaskId ) . collect ( Collectors . toSet ( ) ) ; Map < TaskId , StartedTask > startedTasks = Maps . newHashMap ( ) ; curator . getChildren ( ) . forPath ( startedTasksParentPath ) . stream ( ) . forEach ( ( child ) -> { String fullPath = ZKPaths . makePath ( startedTasksParentPath , child ) ; TaskId taskId = new TaskId ( ZooKeeperConstants . getTaskIdFromStartedTasksPath ( fullPath ) ) ; try { byte [ ] bytes = curator . getData ( ) . forPath ( fullPath ) ; StartedTask startedTask = serializer . deserialize ( bytes , . class ) ; startedTasks . put ( taskId , startedTask ) ; notStartedTasks . remove ( taskId ) ; } catch ( ignore ) { } catch ( e ) { throw new < e > RuntimeException ( ( "Trying<seq2seq4repair_space>to<seq2seq4repair_space>read<seq2seq4repair_space>started<seq2seq4repair_space>task<seq2seq4repair_space>info<seq2seq4repair_space>from:<seq2seq4repair_space>" + fullPath ) ) ; } } ) ; curator . getChildren ( ) . forPath ( completedTaskParentPath ) . stream ( ) . forEach ( ( child ) -> { String fullPath = ZKPaths . makePath ( completedTaskParentPath , child ) ; TaskId taskId = new TaskId ( ZooKeeperConstants . getTaskIdFromCompletedTasksPath ( fullPath ) ) ; StartedTask startedTask = startedTasks . remove ( taskId ) ; if ( startedTask != null ) { try { byte [ ] bytes = curator . getData ( ) . forPath ( fullPath ) ; TaskExecutionResult taskExecutionResult = serializer . deserialize ( bytes , . class ) ; <START_BUG> taskInfos . add ( new TaskInfo ( taskId , startedTask . getInstanceName ( ) , startedTask . getStartDateUtc ( ) , taskExecutionResult ) ) ; <END_BUG> notStartedTasks . remove ( taskId ) ; } catch ( ignore ) { } catch ( e ) { throw new < e > RuntimeException ( ( "Trying<seq2seq4repair_space>to<seq2seq4repair_space>read<seq2seq4repair_space>completed<seq2seq4repair_space>task<seq2seq4repair_space>info<seq2seq4repair_space>from:<seq2seq4repair_space>" + fullPath ) ) ; } } } ) ; startedTasks . entrySet ( ) . forEach ( ( entry ) -> { StartedTask startedTask = entry . getValue ( ) ; taskInfos . add ( new TaskInfo ( entry . getKey ( ) , startedTask . getInstanceName ( ) , startedTask . getStartDateUtc ( ) , startedTask . getProgress ( ) ) ) ; } ) ; notStartedTasks . forEach ( ( taskId ) -> taskInfos . add ( new TaskInfo ( taskId ) ) ) ; } catch ( Throwable e ) { throw new RuntimeException ( e ) ; } return taskInfos ; } public Serializer getSerializer ( ) { } @ VisibleForTesting SchedulerSelector getSchedulerSelector ( ) { } private void executeTask ( TaskExecutor taskExecutor , ExecutableTask executableTask ) { } private List < QueueConsumer > makeTaskConsumers ( QueueFactory queueFactory , List < TaskExecutorSpec > specs ) { } }

Fix:
taskInfos . add ( new TaskInfo ( taskId , startedTask . getInstanceName ( ) , startedTask . getStartDateUtc ( ) , startedTask . getProgress ( ) , taskExecutionResult ) ) ;