Program: 49169
Project: 49169
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void createCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String name,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String distro,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String specFilePath,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String rpNames,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String dsNames,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String networkName,@CliOption(key={"String_Node_Str"},mandatory=false,specifiedDefaultValue="String_Node_Str",unspecifiedDefaultValue="String_Node_Str",help="String_Node_Str") final boolean resume,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",specifiedDefaultValue="String_Node_Str",help="String_Node_Str") final boolean skipConfigValidation,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",specifiedDefaultValue="String_Node_Str",help="String_Node_Str") final boolean alwaysAnswerYes){
  this.alwaysAnswerYes=alwaysAnswerYes;
  if (name.indexOf("String_Node_Str") != -1) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_CLUSTER + Constants.PARAM_NOT_CONTAIN_HORIZONTAL_LINE);
    return;
  }
  if (resume) {
    resumeCreateCluster(name);
    return;
  }
  ClusterCreate clusterCreate=new ClusterCreate();
  clusterCreate.setName(name);
  if (distro != null) {
    List<String> distroNames=getDistroNames();
    if (validName(distro,distroNames)) {
      clusterCreate.setDistro(distro);
    }
 else {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_DISTRO + Constants.PARAM_NOT_SUPPORTED + distroNames);
      return;
    }
  }
  clusterCreate.setType(Enum.valueOf(ClusterType.class,"String_Node_Str"));
  if (rpNames != null) {
    List<String> rpNamesList=CommandsUtils.inputsConvert(rpNames);
    if (rpNamesList.isEmpty()) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INPUT_RPNAMES_PARAM + Constants.MULTI_INPUTS_CHECK);
      return;
    }
 else {
      clusterCreate.setRpNames(rpNamesList);
    }
  }
  if (dsNames != null) {
    List<String> dsNamesList=CommandsUtils.inputsConvert(dsNames);
    if (dsNamesList.isEmpty()) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INPUT_DSNAMES_PARAM + Constants.MULTI_INPUTS_CHECK);
      return;
    }
 else {
      clusterCreate.setDsNames(dsNamesList);
    }
  }
  List<String> warningMsgList=new ArrayList<String>();
  try {
    if (specFilePath != null) {
      ClusterCreate clusterSpec=CommandsUtils.getObjectByJsonString(ClusterCreate.class,CommandsUtils.dataFromFile(specFilePath));
      clusterCreate.setExternalHDFS(clusterSpec.getExternalHDFS());
      clusterCreate.setNodeGroups(clusterSpec.getNodeGroups());
      clusterCreate.setConfiguration(clusterSpec.getConfiguration());
      validateConfiguration(clusterCreate,skipConfigValidation,warningMsgList);
      if (!validateHAInfo(clusterCreate.getNodeGroups())) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_CLUSTER_SPEC_HA_ERROR + specFilePath);
        return;
      }
    }
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
  List<String> networkNames=getNetworkNames();
  if (networkNames.isEmpty()) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_NETWORK_NAME + Constants.PARAM_NOT_EXISTED);
    return;
  }
 else {
    if (networkName != null) {
      if (validName(networkName,networkNames)) {
        clusterCreate.setNetworkName(networkName);
      }
 else {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_NETWORK_NAME + Constants.PARAM_NOT_SUPPORTED + networkNames);
        return;
      }
    }
 else {
      if (networkNames.size() == 1) {
        clusterCreate.setNetworkName(networkNames.get(0));
      }
 else {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_NETWORK_NAME + Constants.PARAM_NOT_SPECIFIED);
        return;
      }
    }
  }
  if (specFilePath != null) {
    if (!validateClusterCreate(clusterCreate)) {
      return;
    }
  }
  try {
    if (!showWarningMsg(clusterCreate.getName(),warningMsgList)) {
      return;
    }
    restClient.create(clusterCreate);
    if (specFilePath == null) {
      createDefalutFile(clusterCreate);
    }
    CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESULT_CREAT);
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
  }
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void createCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String name,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String distro,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String specFilePath,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String rpNames,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String dsNames,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String networkName,@CliOption(key={"String_Node_Str"},mandatory=false,specifiedDefaultValue="String_Node_Str",unspecifiedDefaultValue="String_Node_Str",help="String_Node_Str") final boolean resume,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",specifiedDefaultValue="String_Node_Str",help="String_Node_Str") final boolean skipConfigValidation,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",specifiedDefaultValue="String_Node_Str",help="String_Node_Str") final boolean alwaysAnswerYes){
  this.alwaysAnswerYes=alwaysAnswerYes;
  if (name.indexOf("String_Node_Str") != -1) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_CLUSTER + Constants.PARAM_NOT_CONTAIN_HORIZONTAL_LINE);
    return;
  }
  if (resume) {
    resumeCreateCluster(name);
    return;
  }
  ClusterCreate clusterCreate=new ClusterCreate();
  clusterCreate.setName(name);
  if (distro != null) {
    List<String> distroNames=getDistroNames();
    if (validName(distro,distroNames)) {
      clusterCreate.setDistro(distro);
    }
 else {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_DISTRO + Constants.PARAM_NOT_SUPPORTED + distroNames);
      return;
    }
  }
  clusterCreate.setType(Enum.valueOf(ClusterType.class,"String_Node_Str"));
  if (rpNames != null) {
    List<String> rpNamesList=CommandsUtils.inputsConvert(rpNames);
    if (rpNamesList.isEmpty()) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INPUT_RPNAMES_PARAM + Constants.MULTI_INPUTS_CHECK);
      return;
    }
 else {
      clusterCreate.setRpNames(rpNamesList);
    }
  }
  if (dsNames != null) {
    List<String> dsNamesList=CommandsUtils.inputsConvert(dsNames);
    if (dsNamesList.isEmpty()) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INPUT_DSNAMES_PARAM + Constants.MULTI_INPUTS_CHECK);
      return;
    }
 else {
      clusterCreate.setDsNames(dsNamesList);
    }
  }
  List<String> warningMsgList=new ArrayList<String>();
  try {
    if (specFilePath != null) {
      ClusterCreate clusterSpec=CommandsUtils.getObjectByJsonString(ClusterCreate.class,CommandsUtils.dataFromFile(specFilePath));
      clusterCreate.setExternalHDFS(clusterSpec.getExternalHDFS());
      clusterCreate.setNodeGroups(clusterSpec.getNodeGroups());
      clusterCreate.setConfiguration(clusterSpec.getConfiguration());
      validateConfiguration(clusterCreate,skipConfigValidation,warningMsgList);
      if (!validateHAInfo(clusterCreate.getNodeGroups())) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_CLUSTER_SPEC_HA_ERROR + specFilePath);
        return;
      }
      clusterCreate.setDefault(false);
    }
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
  List<String> networkNames=getNetworkNames();
  if (networkNames.isEmpty()) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_NETWORK_NAME + Constants.PARAM_NOT_EXISTED);
    return;
  }
 else {
    if (networkName != null) {
      if (validName(networkName,networkNames)) {
        clusterCreate.setNetworkName(networkName);
      }
 else {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_NETWORK_NAME + Constants.PARAM_NOT_SUPPORTED + networkNames);
        return;
      }
    }
 else {
      if (networkNames.size() == 1) {
        clusterCreate.setNetworkName(networkNames.get(0));
      }
 else {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_NETWORK_NAME + Constants.PARAM_NOT_SPECIFIED);
        return;
      }
    }
  }
  if (specFilePath != null) {
    if (!validateClusterCreate(clusterCreate)) {
      return;
    }
  }
  try {
    if (!showWarningMsg(clusterCreate.getName(),warningMsgList)) {
      return;
    }
    restClient.create(clusterCreate);
    if (specFilePath == null) {
      createDefalutFile(clusterCreate.getName());
    }
    CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESULT_CREAT);
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
  }
}