Source:
public Response getTaskStatus(@PathParam("taskid") String taskid) { final TaskInfo<Task, TaskStatus> taskInfo = taskStorageQueryAdapter.getTaskInfo(taskid); TaskStatusResponse response = null; if (taskInfo != null) { if (taskMaster.getTaskRunner().isPresent()) { final TaskRunner taskRunner = taskMaster.getTaskRunner().get(); final TaskRunnerWorkItem workItem = taskRunner .getKnownTasks() .stream() .filter(item -> item.getTaskId().equals(taskid)) .findAny() .orElse(null); if (workItem != null) { response = new TaskStatusResponse( workItem.getTaskId(), new TaskStatusPlus( taskInfo.getId(), taskInfo.getTask() == null ? null : taskInfo.getTask().getType(), taskInfo.getCreatedTime(), DateTimes.EPOCH, taskInfo.getStatus().getStatusCode(), taskInfo.getStatus().getStatusCode(), taskRunner.getRunnerTaskState(workItem.getTaskId()), taskInfo.getStatus().getDuration(), workItem.getLocation(), taskInfo.getDataSource(), taskInfo.getStatus().getErrorMsg() ) ); } } if (response == null) { response = new TaskStatusResponse( taskid, new TaskStatusPlus( taskInfo.getId(), taskInfo.getTask() == null ? null : taskInfo.getTask().getType(), taskInfo.getCreatedTime(), DateTimes.EPOCH, taskInfo.getStatus().getStatusCode(), taskInfo.getStatus().getStatusCode(), RunnerTaskState.WAITING, taskInfo.getStatus().getDuration(), TaskLocation.unknown(), taskInfo.getDataSource(), taskInfo.getStatus().getErrorMsg() ) ); } } else { response = new TaskStatusResponse(taskid, null); } final Response.Status status = response.getStatus() == null ? Response.Status.NOT_FOUND : Response.Status.OK; return Response.status(status).entity(response).build(); }

Target:
public Response getTaskStatus(@PathParam("taskid") String taskid) { final TaskInfo<Task, TaskStatus> taskInfo = taskStorageQueryAdapter.getTaskInfo(taskid); TaskStatusResponse response = null; if (taskInfo != null) { if (taskMaster.getTaskRunner().isPresent()) { final TaskRunner taskRunner = taskMaster.getTaskRunner().get(); final TaskRunnerWorkItem workItem = taskRunner .getKnownTasks() .stream() .filter(item -> item.getTaskId().equals(taskid)) .findAny() .orElse(null); if (workItem != null) { response = new TaskStatusResponse( workItem.getTaskId(), new TaskStatusPlus( taskInfo.getId(), taskInfo.getTask() == null ? null : taskInfo.getTask().getType(), taskInfo.getCreatedTime(), DateTimes.EPOCH, taskInfo.getStatus().getStatusCode(), taskRunner.getRunnerTaskState(workItem.getTaskId()), taskInfo.getStatus().getDuration(), workItem.getLocation(), taskInfo.getDataSource(), taskInfo.getStatus().getErrorMsg() ) ); } } if (response == null) { response = new TaskStatusResponse( taskid, new TaskStatusPlus( taskInfo.getId(), taskInfo.getTask() == null ? null : taskInfo.getTask().getType(), taskInfo.getCreatedTime(), DateTimes.EPOCH, taskInfo.getStatus().getStatusCode(), RunnerTaskState.WAITING, taskInfo.getStatus().getDuration(), TaskLocation.unknown(), taskInfo.getDataSource(), taskInfo.getStatus().getErrorMsg() ) ); } } else { response = new TaskStatusResponse(taskid, null); } final Response.Status status = response.getStatus() == null ? Response.Status.NOT_FOUND : Response.Status.OK; return Response.status(status).entity(response).build(); }