Program: 48986
Project: 48986
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();
      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 (taskRead.getStatus() != TaskRead.Status.COMPLETED && taskRead.getStatus() != TaskRead.Status.FAILED && taskRead.getStatus() != TaskRead.Status.ABANDONED && taskRead.getStatus() != TaskRead.Status.STOPPED);
    String logdir=taskRead.getWorkDir();
    String errorMsg=taskRead.getErrorMessage();
    if (!taskRead.getStatus().equals(TaskRead.Status.COMPLETED)) {
      if (!CommandsUtils.isBlank(logdir)) {
        String outputErrorInfo=Constants.OUTPUT_LOG_INFO + Constants.COMMON_LOG_FILE_PATH + "String_Node_Str"+ logdir;
        if (errorMsg != null) {
          outputErrorInfo=errorMsg + "String_Node_Str" + outputErrorInfo;
        }
        throw new CliRestException(outputErrorInfo);
      }
 else       if (errorMsg != null && !errorMsg.isEmpty()) {
        String outputErrorInfo=errorMsg + "String_Node_Str" + Constants.OUTPUT_LOG_INFO+ Constants.COMMON_LOG_FILE_PATH;
        throw new CliRestException(outputErrorInfo);
      }
 else {
        throw new CliRestException("String_Node_Str");
      }
    }
 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();
      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 (taskRead.getStatus() != TaskRead.Status.COMPLETED && taskRead.getStatus() != TaskRead.Status.FAILED && taskRead.getStatus() != TaskRead.Status.ABANDONED && taskRead.getStatus() != TaskRead.Status.STOPPED);
    String errorMsg=taskRead.getErrorMessage();
    if (!taskRead.getStatus().equals(TaskRead.Status.COMPLETED)) {
      String outputErrorInfo=Constants.OUTPUT_LOG_INFO + Constants.COMMON_LOG_FILE_PATH;
      if (errorMsg != null) {
        outputErrorInfo=errorMsg + "String_Node_Str" + outputErrorInfo;
      }
      throw new CliRestException(outputErrorInfo);
    }
 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;
}