Source:
<code>public Response getTaskStatus(@PathParam("taskid") String taskid) { final Task task = taskStorageQueryAdapter.getTask(taskid).orNull(); final TaskStatus taskStatus = taskStorageQueryAdapter.getStatus(taskid).orNull(); final Pair<DateTime, String> createdDateAndDataSource = taskStorageQueryAdapter.getCreatedDateAndDataSource( taskid ); final TaskStatusResponse response; if (taskMaster.getTaskRunner().isPresent() && task != null && taskStatus != null && createdDateAndDataSource != null) { 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( taskid, new TaskStatusPlus( taskid, task.getType(), createdDateAndDataSource.lhs, workItem.getQueueInsertionTime(), taskStatus.getStatusCode(), taskStatus.getDuration(), workItem.getLocation(), createdDateAndDataSource.rhs, null ) ); } else { response = new TaskStatusResponse( taskid, new TaskStatusPlus( taskid, task.getType(), createdDateAndDataSource.lhs, DateTimes.EPOCH, taskStatus.getStatusCode(), taskStatus.getDuration(), TaskLocation.unknown(), createdDateAndDataSource.rhs, null ) ); } } else { <START> response = new TaskStatusResponse(taskid, null); <END> } final Response.Status status = response.getStatus() == null ? Response.Status.NOT_FOUND : Response.Status.OK; return Response.status(status).entity(response).build(); }</code><technical_language>If taskStatus is null, try fill in of a TaskStatusPlus it, instead of returning null, maintain behavior similar previous in case taskMaster.getTaskRunner().isPresent() evaluates false</technical_language>

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(); }