Program: 48494
Project: 48494
Buggy source:
public Long stopCluster(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  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);
  }
  ValidationUtils.validateVersion(clusterEntityMgr,clusterName);
  if (ClusterStatus.STOPPED.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw ClusterManagerException.ALREADY_STOPPED_ERROR(clusterName);
  }
  if (!cluster.getStatus().isActiveServiceStatus() && !ClusterStatus.SERVICE_STOPPED.equals(cluster.getStatus()) && !ClusterStatus.ERROR.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.STOP_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  Map<String,JobParameter> param=new TreeMap<String,JobParameter>();
  param.put(JobConstants.CLUSTER_NAME_JOB_PARAM,new JobParameter(clusterName));
  param.put(JobConstants.TIMESTAMP_JOB_PARAM,new JobParameter(new Date()));
  param.put(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM,new JobParameter(ClusterStatus.STOPPED.name()));
  param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,new JobParameter(ClusterStatus.ERROR.name()));
  JobParameters jobParameters=new JobParameters(param);
  clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.STOPPING);
  clusterEntityMgr.cleanupActionError(clusterName);
  try {
    return jobManager.runJob(JobConstants.STOP_CLUSTER_JOB_NAME,jobParameters);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + clusterName,e);
    clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.ERROR);
    throw e;
  }
}

Fixed version (ground truth):
public Long stopCluster(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  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);
  }
  ValidationUtils.validateVersion(clusterEntityMgr,clusterName);
  if (ClusterStatus.STOPPED.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw ClusterManagerException.ALREADY_STOPPED_ERROR(clusterName);
  }
  if (!cluster.getStatus().isActiveServiceStatus() && !ClusterStatus.SERVICE_STOPPED.equals(cluster.getStatus()) && !ClusterStatus.ERROR.equals(cluster.getStatus())&& !ClusterStatus.SERVICE_WARNING.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.STOP_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  Map<String,JobParameter> param=new TreeMap<String,JobParameter>();
  param.put(JobConstants.CLUSTER_NAME_JOB_PARAM,new JobParameter(clusterName));
  param.put(JobConstants.TIMESTAMP_JOB_PARAM,new JobParameter(new Date()));
  param.put(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM,new JobParameter(ClusterStatus.STOPPED.name()));
  param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,new JobParameter(ClusterStatus.ERROR.name()));
  JobParameters jobParameters=new JobParameters(param);
  clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.STOPPING);
  clusterEntityMgr.cleanupActionError(clusterName);
  try {
    return jobManager.runJob(JobConstants.STOP_CLUSTER_JOB_NAME,jobParameters);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + clusterName,e);
    clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.ERROR);
    throw e;
  }
}