Program: 48543
Project: 48543
Buggy source:
private boolean handleNodeStatus(ClusterReport report,boolean lastUpdate){
  boolean finished=report.isFinished();
  ClusterEntity cluster=findByName(report.getName());
  Map<String,NodeReport> nodeReportMap=report.getNodeReports();
  for (  NodeGroupEntity group : cluster.getNodeGroups()) {
    for (    NodeEntity node : group.getNodes()) {
      NodeReport nodeReport=nodeReportMap.get(node.getVmName());
      if (nodeReport == null) {
        continue;
      }
      if (nodeReport.getStatus() != null) {
        if (!node.isDisconnected() && node.getStatus().ordinal() >= NodeStatus.VM_READY.ordinal()) {
          logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ nodeReport.getStatus().toString());
          NodeStatus oldStatus=node.getStatus();
switch (nodeReport.getStatus()) {
case STARTED:
            node.setStatus(NodeStatus.SERVICE_READY,false);
          break;
case UNHEALTHY:
        node.setStatus(NodeStatus.SERVICE_UNHEALTHY,false);
      break;
case ALERT:
    node.setStatus(NodeStatus.SERVICE_ALERT,false);
  break;
case UNKONWN:
node.setStatus(NodeStatus.UNKNOWN,false);
break;
case PROVISIONING:
case STOPPED:
node.setStatus(NodeStatus.VM_READY,false);
break;
default :
node.setStatus(NodeStatus.BOOTSTRAP_FAILED,false);
}
logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ oldStatus+ "String_Node_Str"+ node.getStatus());
}
}
if (nodeReport.isUseClusterMsg() && report.getAction() != null) {
logger.debug("String_Node_Str" + report.getAction());
node.setAction(report.getAction());
}
 else if (nodeReport.getAction() != null) {
node.setAction(nodeReport.getAction());
}
if (lastUpdate) {
if (nodeReport.getErrMsg() != null) {
logger.debug("String_Node_Str" + report.getAction());
node.setErrMessage(nodeReport.getErrMsg());
node.setActionFailed(true);
}
 else {
logger.debug("String_Node_Str" + node.getHostName());
node.setErrMessage(null);
node.setActionFailed(false);
}
}
}
}
return finished;
}

Fixed version (ground truth):
private boolean handleNodeStatus(ClusterReport report,boolean lastUpdate){
  boolean finished=report.isFinished();
  ClusterEntity cluster=findByName(report.getName());
  Map<String,NodeReport> nodeReportMap=report.getNodeReports();
  for (  NodeGroupEntity group : cluster.getNodeGroups()) {
    for (    NodeEntity node : group.getNodes()) {
      NodeReport nodeReport=nodeReportMap.get(node.getVmName());
      if (nodeReport == null) {
        continue;
      }
      if (nodeReport.getStatus() != null) {
        if (!node.isDisconnected() && node.getStatus().ordinal() >= NodeStatus.VM_READY.ordinal()) {
          logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ nodeReport.getStatus().toString());
          NodeStatus oldStatus=node.getStatus();
switch (nodeReport.getStatus()) {
case STARTED:
            node.setStatus(NodeStatus.SERVICE_READY,false);
          break;
case UNHEALTHY:
        node.setStatus(NodeStatus.SERVICE_UNHEALTHY,false);
      break;
case ALERT:
    if (node.getStatus() != NodeStatus.BOOTSTRAP_FAILED) {
      node.setStatus(NodeStatus.SERVICE_ALERT,false);
    }
  break;
case UNKONWN:
node.setStatus(NodeStatus.UNKNOWN,false);
break;
case PROVISIONING:
case STOPPED:
if (node.getStatus() != NodeStatus.BOOTSTRAP_FAILED) {
node.setStatus(NodeStatus.VM_READY,false);
}
break;
default :
node.setStatus(NodeStatus.BOOTSTRAP_FAILED,false);
}
logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ oldStatus+ "String_Node_Str"+ node.getStatus());
}
}
if (nodeReport.isUseClusterMsg() && report.getAction() != null) {
logger.debug("String_Node_Str" + report.getAction());
node.setAction(report.getAction());
}
 else if (nodeReport.getAction() != null) {
node.setAction(nodeReport.getAction());
}
if (lastUpdate) {
if (nodeReport.getErrMsg() != null) {
logger.debug("String_Node_Str" + report.getAction());
node.setErrMessage(nodeReport.getErrMsg());
node.setActionFailed(true);
}
 else {
logger.debug("String_Node_Str" + node.getHostName());
node.setErrMessage(null);
node.setActionFailed(false);
}
}
}
}
return finished;
}