Program: 48541
Project: 48541
Buggy source:
@Override public boolean poll(){
  Long requestId=apiRequestSummary.getApiRequestInfo().getRequestId();
  ApiRequest apiRequest=apiManager.getRequestWithTasks(clusterName,requestId);
  ClusterRequestStatus clusterRequestStatus=ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo().getRequestStatus());
  Map<String,NodeReport> nodeReports=currentReport.getNodeReports();
  for (  String nodeReportKey : nodeReports.keySet()) {
    for (    ApiTask apiTask : apiRequest.getApiTasks()) {
      NodeReport nodeReport=nodeReports.get(nodeReportKey);
      nodeReport.setUseClusterMsg(false);
      ApiTaskInfo apiTaskInfo=apiTask.getApiTaskInfo();
      if (nodeReport.getHostname().equals(apiTaskInfo.getHostName())) {
        TaskStatus taskStatus=TaskStatus.valueOf(apiTask.getApiTaskInfo().getStatus());
        if (taskStatus.isRunningState()) {
          if (clusterRequestStatus.isFailedState() && apiTaskInfo.getStderr() != null && !apiTaskInfo.getStderr().isEmpty()) {
            nodeReport.setAction(apiTaskInfo.getCommandDetail() + "String_Node_Str" + apiTaskInfo.getStderr());
          }
 else {
            nodeReport.setAction(apiTaskInfo.getCommandDetail());
          }
          nodeReports.put(nodeReportKey,nodeReport);
        }
      }
    }
  }
  currentReport.setNodeReports(nodeReports);
  int provisionPercent=(int)apiRequest.getApiRequestInfo().getProgressPercent();
  if (provisionPercent != 0) {
    int currentProgress=currentReport.getProgress();
    int toProgress=beginProgress + provisionPercent / 2;
    if (toProgress >= endProgress) {
      toProgress=endProgress;
    }
    boolean isCompletedState=clusterRequestStatus.isCompletedState();
    if ((toProgress != currentProgress) && (provisionPercent % 10 == 0) || isCompletedState) {
      if (isCompletedState) {
        logger.info("String_Node_Str" + requestId + "String_Node_Str");
      }
 else {
        logger.info("String_Node_Str" + requestId + "String_Node_Str");
      }
      currentReport.setProgress(toProgress);
      if (reportQueue != null) {
        reportQueue.addClusterReport(currentReport.clone());
      }
    }
  }
  if (clusterRequestStatus.isCompletedState()) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean poll(){
  if (apiRequestSummary == null) {
    return true;
  }
  Long requestId=apiRequestSummary.getApiRequestInfo().getRequestId();
  ApiRequest apiRequest=apiManager.getRequestWithTasks(clusterName,requestId);
  ClusterRequestStatus clusterRequestStatus=ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo().getRequestStatus());
  Map<String,NodeReport> nodeReports=currentReport.getNodeReports();
  for (  String nodeReportKey : nodeReports.keySet()) {
    for (    ApiTask apiTask : apiRequest.getApiTasks()) {
      NodeReport nodeReport=nodeReports.get(nodeReportKey);
      nodeReport.setUseClusterMsg(false);
      ApiTaskInfo apiTaskInfo=apiTask.getApiTaskInfo();
      if (nodeReport.getHostname().equals(apiTaskInfo.getHostName())) {
        TaskStatus taskStatus=TaskStatus.valueOf(apiTask.getApiTaskInfo().getStatus());
        if (taskStatus.isRunningState()) {
          if (clusterRequestStatus.isFailedState() && apiTaskInfo.getStderr() != null && !apiTaskInfo.getStderr().isEmpty()) {
            nodeReport.setAction(apiTaskInfo.getCommandDetail() + "String_Node_Str" + apiTaskInfo.getStderr());
          }
 else {
            nodeReport.setAction(apiTaskInfo.getCommandDetail());
          }
          nodeReports.put(nodeReportKey,nodeReport);
        }
      }
    }
  }
  currentReport.setNodeReports(nodeReports);
  int provisionPercent=(int)apiRequest.getApiRequestInfo().getProgressPercent();
  if (provisionPercent != 0) {
    int currentProgress=currentReport.getProgress();
    int toProgress=beginProgress + provisionPercent / 2;
    if (toProgress >= endProgress) {
      toProgress=endProgress;
    }
    boolean isCompletedState=clusterRequestStatus.isCompletedState();
    if ((toProgress != currentProgress) && (provisionPercent % 10 == 0) || isCompletedState) {
      if (isCompletedState) {
        logger.info("String_Node_Str" + requestId + "String_Node_Str");
      }
 else {
        logger.info("String_Node_Str" + requestId + "String_Node_Str");
      }
      currentReport.setProgress(toProgress);
      if (reportQueue != null) {
        reportQueue.addClusterReport(currentReport.clone());
      }
    }
  }
  if (clusterRequestStatus.isCompletedState()) {
    return true;
  }
  return false;
}