Program: 48830
Project: 48830
Buggy source:
/** 
 * set cluster parameters asynchronously
 * @param clusterName
 * @param activeComputeNodeNum
 * @param minComputeNodeNum
 * @param maxComputeNodeNum
 * @param enableAuto
 * @param ioPriority
 * @return
 * @throws Exception
 */
public Long asyncSetParam(String clusterName,Integer activeComputeNodeNum,Integer minComputeNodeNum,Integer maxComputeNodeNum,Boolean enableAuto,Priority ioPriority) throws Exception {
  syncSetParam(clusterName,activeComputeNodeNum,minComputeNodeNum,maxComputeNodeNum,enableAuto,ioPriority);
  ClusterRead cluster=getClusterByName(clusterName,false);
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus())) {
    String msg="String_Node_Str" + clusterName + "String_Node_Str";
    logger.error(msg);
    throw ClusterManagerException.SET_MANUAL_ELASTICITY_NOT_ALLOWED_ERROR(msg);
  }
  Map<String,JobParameter> param=new TreeMap<String,JobParameter>();
  param.put(JobConstants.TIMESTAMP_JOB_PARAM,new JobParameter(new Date()));
  param.put(JobConstants.CLUSTER_NAME_JOB_PARAM,new JobParameter(clusterName));
  if (activeComputeNodeNum == null) {
    activeComputeNodeNum=cluster.getVhmTargetNum();
  }
  if (activeComputeNodeNum == -1) {
    param.put(JobConstants.VHM_ACTION_JOB_PARAM,new JobParameter(LimitInstruction.actionUnlimit));
  }
 else {
    param.put(JobConstants.VHM_ACTION_JOB_PARAM,new JobParameter(LimitInstruction.actionSetTarget));
  }
  param.put(JobConstants.ACTIVE_COMPUTE_NODE_NUMBER_JOB_PARAM,new JobParameter(Long.valueOf(activeComputeNodeNum)));
  param.put(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM,new JobParameter(ClusterStatus.RUNNING.name()));
  param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,new JobParameter(ClusterStatus.RUNNING.name()));
  JobParameters jobParameters=new JobParameters(param);
  try {
    clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.VHM_RUNNING);
    return jobManager.runJob(JobConstants.SET_MANUAL_ELASTICITY_JOB_NAME,jobParameters);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + clusterName,e);
    clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.RUNNING);
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * set cluster parameters asynchronously
 * @param clusterName
 * @param activeComputeNodeNum
 * @param minComputeNodeNum
 * @param maxComputeNodeNum
 * @param enableAuto
 * @param ioPriority
 * @return
 * @throws Exception
 */
public Long asyncSetParam(String clusterName,Integer activeComputeNodeNum,Integer minComputeNodeNum,Integer maxComputeNodeNum,Boolean enableAuto,Priority ioPriority) throws Exception {
  syncSetParam(clusterName,activeComputeNodeNum,minComputeNodeNum,maxComputeNodeNum,enableAuto,ioPriority);
  ClusterRead cluster=getClusterByName(clusterName,false);
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus())) {
    String msg="String_Node_Str" + clusterName + "String_Node_Str";
    logger.error(msg);
    throw ClusterManagerException.SET_MANUAL_ELASTICITY_NOT_ALLOWED_ERROR(msg);
  }
  Map<String,JobParameter> param=new TreeMap<String,JobParameter>();
  param.put(JobConstants.TIMESTAMP_JOB_PARAM,new JobParameter(new Date()));
  param.put(JobConstants.CLUSTER_NAME_JOB_PARAM,new JobParameter(clusterName));
  if (activeComputeNodeNum == null) {
    param.put(JobConstants.VHM_ACTION_JOB_PARAM,new JobParameter(LimitInstruction.actionWaitForManual));
  }
 else   if (activeComputeNodeNum == -1) {
    param.put(JobConstants.VHM_ACTION_JOB_PARAM,new JobParameter(LimitInstruction.actionUnlimit));
  }
 else {
    param.put(JobConstants.VHM_ACTION_JOB_PARAM,new JobParameter(LimitInstruction.actionSetTarget));
  }
  if (activeComputeNodeNum != null) {
    param.put(JobConstants.ACTIVE_COMPUTE_NODE_NUMBER_JOB_PARAM,new JobParameter(Long.valueOf(activeComputeNodeNum)));
  }
  param.put(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM,new JobParameter(ClusterStatus.RUNNING.name()));
  param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,new JobParameter(ClusterStatus.RUNNING.name()));
  JobParameters jobParameters=new JobParameters(param);
  try {
    clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.VHM_RUNNING);
    return jobManager.runJob(JobConstants.SET_MANUAL_ELASTICITY_JOB_NAME,jobParameters);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + clusterName,e);
    clusterEntityMgr.updateClusterStatus(clusterName,ClusterStatus.RUNNING);
    throw e;
  }
}