Program: 48328
Project: 48328
Buggy source:
private TaskRead processResponse(ResponseEntity<String> response,HttpMethod verb,PrettyOutput... prettyOutput) throws Exception {
  HttpStatus responseStatus=response.getStatusCode();
  if (responseStatus == HttpStatus.ACCEPTED) {
    HttpHeaders headers=response.getHeaders();
    URI taskURI=headers.getLocation();
    String[] taskURIs=taskURI.toString().split("String_Node_Str");
    String taskId=taskURIs[taskURIs.length - 1];
    TaskRead taskRead;
    int oldProgress=0;
    Status oldTaskStatus=null;
    Status taskStatus=null;
    int progress=0;
    do {
      ResponseEntity<TaskRead> taskResponse=restGetById(Constants.REST_PATH_TASK,taskId,TaskRead.class,false);
      taskRead=taskResponse.getBody();
      progress=(int)(taskRead.getProgress() * 100);
      taskStatus=taskRead.getStatus();
      Type taskType=taskRead.getType();
      if ((taskType == Type.DELETE) && (taskStatus == TaskRead.Status.COMPLETED)) {
        clearScreen();
        System.out.println(taskStatus + "String_Node_Str" + progress+ "String_Node_Str");
        break;
      }
      if (taskType == Type.SHRINK && !taskRead.getFailNodes().isEmpty()) {
        throw new CliRestException(taskRead.getFailNodes().get(0).getErrorMessage());
      }
      if ((prettyOutput != null && prettyOutput.length > 0 && (taskRead.getType() == Type.VHM ? prettyOutput[0].isRefresh(true) : prettyOutput[0].isRefresh(false))) || oldTaskStatus != taskStatus || oldProgress != progress) {
        clearScreen();
        if (prettyOutput != null && prettyOutput.length > 0 && prettyOutput[0].getCompletedTaskSummary() != null) {
          for (          String summary : prettyOutput[0].getCompletedTaskSummary()) {
            System.out.println(summary + "String_Node_Str");
          }
        }
        System.out.println(taskStatus + "String_Node_Str" + progress+ "String_Node_Str");
        if (prettyOutput != null && prettyOutput.length > 0) {
          prettyOutput[0].prettyOutput();
        }
        if (oldTaskStatus != taskStatus || oldProgress != progress) {
          oldTaskStatus=taskStatus;
          oldProgress=progress;
          if (taskRead.getProgressMessage() != null) {
            System.out.println(taskRead.getProgressMessage());
          }
        }
      }
      try {
        Thread.sleep(3 * 1000);
      }
 catch (      InterruptedException ex) {
      }
    }
 while (taskStatus != TaskRead.Status.COMPLETED && taskStatus != TaskRead.Status.FAILED && taskStatus != TaskRead.Status.ABANDONED && taskStatus != TaskRead.Status.STOPPED);
    String errorMsg=taskRead.getErrorMessage();
    if (!taskRead.getStatus().equals(TaskRead.Status.COMPLETED)) {
      throw new CliRestException(errorMsg);
    }
 else {
      if (taskRead.getType().equals(Type.VHM)) {
        logger.info("String_Node_Str");
        Thread.sleep(5 * 1000);
        if (prettyOutput != null && prettyOutput.length > 0 && prettyOutput[0].isRefresh(true)) {
          clearScreen();
          System.out.println(taskStatus + "String_Node_Str" + progress+ "String_Node_Str");
          if (prettyOutput != null && prettyOutput.length > 0) {
            prettyOutput[0].prettyOutput();
          }
        }
      }
 else {
        return taskRead;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private TaskRead processResponse(ResponseEntity<String> response,HttpMethod verb,PrettyOutput... prettyOutput) throws Exception {
  HttpStatus responseStatus=response.getStatusCode();
  if (responseStatus == HttpStatus.ACCEPTED) {
    HttpHeaders headers=response.getHeaders();
    URI taskURI=headers.getLocation();
    String[] taskURIs=taskURI.toString().split("String_Node_Str");
    String taskId=taskURIs[taskURIs.length - 1];
    TaskRead taskRead;
    int oldProgress=0;
    Status oldTaskStatus=null;
    Status taskStatus=null;
    int progress=0;
    do {
      ResponseEntity<TaskRead> taskResponse=restGetById(Constants.REST_PATH_TASK,taskId,TaskRead.class,false);
      taskRead=taskResponse.getBody();
      progress=(int)(taskRead.getProgress() * 100);
      taskStatus=taskRead.getStatus();
      Type taskType=taskRead.getType();
      if ((taskType == Type.DELETE) && (taskStatus == TaskRead.Status.COMPLETED)) {
        clearScreen();
        System.out.println(taskStatus + "String_Node_Str" + progress+ "String_Node_Str");
        break;
      }
      if (taskType == Type.SHRINK && !taskRead.getFailNodes().isEmpty()) {
        throw new CliRestException(taskRead.getFailNodes().get(0).getErrorMessage());
      }
      if ((prettyOutput != null && prettyOutput.length > 0 && prettyOutput[0].isRefresh(true)) || oldTaskStatus != taskStatus || oldProgress != progress) {
        clearScreen();
        if (prettyOutput != null && prettyOutput.length > 0 && prettyOutput[0].getCompletedTaskSummary() != null) {
          for (          String summary : prettyOutput[0].getCompletedTaskSummary()) {
            System.out.println(summary + "String_Node_Str");
          }
        }
        System.out.println(taskStatus + "String_Node_Str" + progress+ "String_Node_Str");
        if (prettyOutput != null && prettyOutput.length > 0) {
          prettyOutput[0].prettyOutput();
        }
        if (oldTaskStatus != taskStatus || oldProgress != progress) {
          oldTaskStatus=taskStatus;
          oldProgress=progress;
          if (taskRead.getProgressMessage() != null) {
            System.out.println(taskRead.getProgressMessage());
          }
        }
      }
      try {
        Thread.sleep(3 * 1000);
      }
 catch (      InterruptedException ex) {
      }
    }
 while (taskStatus != TaskRead.Status.COMPLETED && taskStatus != TaskRead.Status.FAILED && taskStatus != TaskRead.Status.ABANDONED && taskStatus != TaskRead.Status.STOPPED);
    String errorMsg=taskRead.getErrorMessage();
    if (!taskRead.getStatus().equals(TaskRead.Status.COMPLETED)) {
      throw new CliRestException(errorMsg);
    }
 else {
      if (taskRead.getType().equals(Type.VHM)) {
        logger.info("String_Node_Str");
        Thread.sleep(5 * 1000);
        if (prettyOutput != null && prettyOutput.length > 0 && prettyOutput[0].isRefresh(true)) {
          clearScreen();
          System.out.println(taskStatus + "String_Node_Str" + progress+ "String_Node_Str");
          if (prettyOutput != null && prettyOutput.length > 0) {
            prettyOutput[0].prettyOutput();
          }
        }
      }
 else {
        return taskRead;
      }
    }
  }
  return null;
}