Program: 48984
Project: 48984
Buggy source:
/** 
 * set cluster parameters synchronously
 * @param clusterName
 * @param activeComputeNodeNum
 * @param minComputeNodeNum
 * @param mode
 * @param ioPriority
 * @throws Exception
 */
@SuppressWarnings("String_Node_Str") public List<String> syncSetParam(String clusterName,Integer activeComputeNodeNum,Integer minComputeNodeNum,Boolean enableAuto,Priority ioPriority) throws Exception {
  ClusterEntity cluster=clusterEntityMgr.findByName(clusterName);
  ClusterRead clusterRead=getClusterByName(clusterName,false);
  if (cluster == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (ioPriority != null) {
    prioritizeCluster(clusterName,ioPriority);
  }
  cluster=clusterEntityMgr.findByName(clusterName);
  if (enableAuto != null && enableAuto != cluster.getAutomationEnable()) {
    cluster.setAutomationEnable(enableAuto);
  }
  if (minComputeNodeNum != null && minComputeNodeNum != cluster.getVhmMinNum()) {
    cluster.setVhmMinNum(minComputeNodeNum);
  }
  List<String> nodeGroupNames=new ArrayList<String>();
  if ((enableAuto != null || minComputeNodeNum != null || activeComputeNodeNum != null) && !clusterRead.validateSetManualElasticity(nodeGroupNames)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  if (activeComputeNodeNum != null) {
    if (activeComputeNodeNum != cluster.getVhmTargetNum()) {
      cluster.setVhmTargetNum(activeComputeNodeNum);
    }
  }
  clusterEntityMgr.update(cluster);
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.SET_AUTO_ELASTICITY_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  if (enableAuto != null) {
    boolean success=clusteringService.setAutoElasticity(clusterName);
    if (!success) {
      throw ClusterManagerException.SET_AUTO_ELASTICITY_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
    }
  }
  return nodeGroupNames;
}

Fixed version (ground truth):
/** 
 * set cluster parameters synchronously
 * @param clusterName
 * @param activeComputeNodeNum
 * @param minComputeNodeNum
 * @param mode
 * @param ioPriority
 * @throws Exception
 */
@SuppressWarnings("String_Node_Str") public List<String> syncSetParam(String clusterName,Integer activeComputeNodeNum,Integer minComputeNodeNum,Boolean enableAuto,Priority ioPriority) throws Exception {
  ClusterEntity cluster=clusterEntityMgr.findByName(clusterName);
  ClusterRead clusterRead=getClusterByName(clusterName,false);
  if (cluster == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (ioPriority != null) {
    prioritizeCluster(clusterName,ioPriority);
  }
  cluster=clusterEntityMgr.findByName(clusterName);
  if (enableAuto != null && enableAuto != cluster.getAutomationEnable()) {
    cluster.setAutomationEnable(enableAuto);
  }
  if (minComputeNodeNum != null && minComputeNodeNum != cluster.getVhmMinNum()) {
    cluster.setVhmMinNum(minComputeNodeNum);
  }
  List<String> nodeGroupNames=new ArrayList<String>();
  if ((enableAuto != null || minComputeNodeNum != null || activeComputeNodeNum != null) && !clusterRead.validateSetManualElasticity(nodeGroupNames)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  if (activeComputeNodeNum != null) {
    if (activeComputeNodeNum != cluster.getVhmTargetNum()) {
      cluster.setVhmTargetNum(activeComputeNodeNum);
    }
  }
  if ((enableAuto != null) && !ClusterStatus.RUNNING.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.SET_AUTO_ELASTICITY_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus()) && !ClusterStatus.STOPPED.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.SET_AUTO_ELASTICITY_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  clusterEntityMgr.update(cluster);
  if (enableAuto != null) {
    boolean success=clusteringService.setAutoElasticity(clusterName);
    if (!success) {
      throw ClusterManagerException.SET_AUTO_ELASTICITY_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
    }
  }
  if (enableAuto != null && !enableAuto && cluster.getVhmTargetNum() == null) {
    JobUtils.waitForManual(clusterName,executionService);
  }
  return nodeGroupNames;
}