Program: 48994
Project: 48994
Buggy source:
public Long fixDiskFailures(String clusterName,String groupName) throws Exception {
  ClusterStatus oldStatus=clusterEntityMgr.findByName(clusterName).getStatus();
  if (ClusterStatus.RUNNING != oldStatus) {
    throw ClusterHealServiceException.NOT_SUPPORTED(clusterName,"String_Node_Str");
  }
  List<NodeGroupEntity> nodeGroups;
  if (groupName != null) {
    NodeGroupEntity nodeGroup=clusterEntityMgr.findByName(clusterName,groupName);
    AuAssert.check(nodeGroup != null);
    nodeGroups=new ArrayList<NodeGroupEntity>(1);
    nodeGroups.add(nodeGroup);
  }
 else {
    nodeGroups=clusterEntityMgr.findAllGroups(clusterName);
  }
  boolean workerNodesFound=false;
  JobParametersBuilder parametersBuilder=new JobParametersBuilder();
  List<JobParameters> jobParameterList=new ArrayList<JobParameters>();
  for (  NodeGroupEntity nodeGroup : nodeGroups) {
    List<String> roles=nodeGroup.getRoleNameList();
    if (HadoopRole.hasMgmtRole(roles)) {
      logger.info("String_Node_Str" + nodeGroup.getName() + "String_Node_Str");
      continue;
    }
    workerNodesFound=true;
    for (    NodeEntity node : clusterEntityMgr.findAllNodes(clusterName,nodeGroup.getName())) {
      if (clusterHealService.hasBadDisks(node.getVmName())) {
        logger.warn("String_Node_Str" + node.getVmName() + "String_Node_Str");
        JobParameters nodeParameters=parametersBuilder.addString(JobConstants.CLUSTER_NAME_JOB_PARAM,clusterName).addString(JobConstants.TARGET_NAME_JOB_PARAM,node.getVmName()).addString(JobConstants.GROUP_NAME_JOB_PARAM,nodeGroup.getName()).addString(JobConstants.SUB_JOB_NODE_NAME,node.getVmName()).toJobParameters();
        jobParameterList.add(nodeParameters);
      }
    }
  }
  if (!workerNodesFound) {
    throw ClusterHealServiceException.NOT_SUPPORTED(clusterName,"String_Node_Str");
  }
  if (jobParameterList.isEmpty()) {
    logger.info("String_Node_Str");
    throw ClusterHealServiceException.NOT_NEEDED(clusterName);
  }
  try {
    clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.MAINTENANCE);
    return jobManager.runSubJobForNodes(JobConstants.FIX_NODE_DISK_FAILURE_JOB_NAME,jobParameterList,clusterName,oldStatus,oldStatus);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + e.getMessage());
    throw e;
  }
}

Fixed version (ground truth):
public Long fixDiskFailures(String clusterName,String groupName) throws Exception {
  ClusterEntity cluster=clusterEntityMgr.findByName(clusterName);
  if (cluster == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  ClusterStatus oldStatus=cluster.getStatus();
  if (ClusterStatus.RUNNING != oldStatus) {
    throw ClusterHealServiceException.NOT_SUPPORTED(clusterName,"String_Node_Str");
  }
  List<NodeGroupEntity> nodeGroups;
  if (groupName != null) {
    NodeGroupEntity nodeGroup=clusterEntityMgr.findByName(clusterName,groupName);
    if (nodeGroup == null) {
      logger.error("String_Node_Str" + groupName + "String_Node_Str");
      throw BddException.NOT_FOUND("String_Node_Str",groupName);
    }
    nodeGroups=new ArrayList<NodeGroupEntity>(1);
    nodeGroups.add(nodeGroup);
  }
 else {
    nodeGroups=clusterEntityMgr.findAllGroups(clusterName);
  }
  boolean workerNodesFound=false;
  JobParametersBuilder parametersBuilder=new JobParametersBuilder();
  List<JobParameters> jobParameterList=new ArrayList<JobParameters>();
  for (  NodeGroupEntity nodeGroup : nodeGroups) {
    List<String> roles=nodeGroup.getRoleNameList();
    if (HadoopRole.hasMgmtRole(roles)) {
      logger.info("String_Node_Str" + nodeGroup.getName() + "String_Node_Str");
      continue;
    }
    workerNodesFound=true;
    for (    NodeEntity node : clusterEntityMgr.findAllNodes(clusterName,nodeGroup.getName())) {
      if (clusterHealService.hasBadDisks(node.getVmName())) {
        logger.warn("String_Node_Str" + node.getVmName() + "String_Node_Str");
        JobParameters nodeParameters=parametersBuilder.addString(JobConstants.CLUSTER_NAME_JOB_PARAM,clusterName).addString(JobConstants.TARGET_NAME_JOB_PARAM,node.getVmName()).addString(JobConstants.GROUP_NAME_JOB_PARAM,nodeGroup.getName()).addString(JobConstants.SUB_JOB_NODE_NAME,node.getVmName()).toJobParameters();
        jobParameterList.add(nodeParameters);
      }
    }
  }
  if (!workerNodesFound) {
    throw ClusterHealServiceException.NOT_SUPPORTED(clusterName,"String_Node_Str");
  }
  if (jobParameterList.isEmpty()) {
    logger.info("String_Node_Str");
    throw ClusterHealServiceException.NOT_NEEDED(clusterName);
  }
  try {
    clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.MAINTENANCE);
    return jobManager.runSubJobForNodes(JobConstants.FIX_NODE_DISK_FAILURE_JOB_NAME,jobParameterList,clusterName,oldStatus,oldStatus);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + e.getMessage());
    throw e;
  }
}