Program: 48925
Project: 48925
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 type,@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,help="String_Node_Str") final String topology,@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){
  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;
  }
 else   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_BLANK_SPACE);
    return;
  }
  if (resume) {
    resumeCreateCluster(name);
    return;
  }
  ClusterCreate clusterCreate=new ClusterCreate();
  clusterCreate.setName(name);
  if (type != null) {
    ClusterType clusterType=ClusterType.getByDescription(type);
    if (clusterType == null) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INVALID_VALUE + "String_Node_Str" + "String_Node_Str"+ type);
      return;
    }
    clusterCreate.setType(clusterType);
  }
 else   if (specFilePath == null) {
    clusterCreate.setType(ClusterType.HDFS_MAPRED);
  }
  if (topology != null) {
    try {
      clusterCreate.setTopologyPolicy(TopologyType.valueOf(topology));
    }
 catch (    IllegalArgumentException ex) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INVALID_VALUE + "String_Node_Str" + "String_Node_Str"+ topology);
      return;
    }
  }
 else {
    clusterCreate.setTopologyPolicy(TopologyType.NONE);
  }
  try {
    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;
      }
    }
 else {
      String defaultDistroName=clusterCreate.getDefaultDistroName(distroRestClient.getAll());
      if (CommandsUtils.isBlank(defaultDistroName)) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM__NO_DEFAULT_DISTRO);
        return;
      }
 else {
        clusterCreate.setDistro(defaultDistroName);
      }
    }
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
  DistroRead distroRead=distroRestClient.get(clusterCreate.getDistro());
  clusterCreate.setDistroVendor(distroRead.getVendor());
  clusterCreate.setDistroVersion(distroRead.getVersion());
  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> failedMsgList=new ArrayList<String>();
  List<String> warningMsgList=new ArrayList<String>();
  List<String> networkNames=null;
  try {
    if (specFilePath != null) {
      ClusterCreate clusterSpec=CommandsUtils.getObjectByJsonString(ClusterCreate.class,CommandsUtils.dataFromFile(specFilePath));
      clusterCreate.setSpecFile(true);
      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;
      }
    }
    networkNames=getNetworkNames();
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
  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;
      }
    }
  }
  clusterCreate.validateCDHVersion(warningMsgList);
  if (specFilePath != null && !clusterCreate.getDistro().equalsIgnoreCase(com.vmware.bdd.utils.Constants.MAPR_VENDOR)) {
    List<String> distroRoles=findDistroRoles(clusterCreate);
    clusterCreate.validateClusterCreate(failedMsgList,warningMsgList,distroRoles);
  }
  if (type != null && specFilePath != null) {
    warningMsgList.add(Constants.TYPE_SPECFILE_CONFLICT);
  }
  if (!failedMsgList.isEmpty()) {
    showFailedMsg(clusterCreate.getName(),failedMsgList);
    return;
  }
  try {
    if (!CommandsUtils.showWarningMsg(clusterCreate.getName(),Constants.OUTPUT_OBJECT_CLUSTER,Constants.OUTPUT_OP_CREATE,warningMsgList,alwaysAnswerYes)) {
      return;
    }
    restClient.create(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 type,@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,help="String_Node_Str") final String topology,@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){
  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;
  }
 else   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_BLANK_SPACE);
    return;
  }
  if (resume) {
    resumeCreateCluster(name);
    return;
  }
  ClusterCreate clusterCreate=new ClusterCreate();
  clusterCreate.setName(name);
  if (type != null) {
    ClusterType clusterType=ClusterType.getByDescription(type);
    if (clusterType == null) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INVALID_VALUE + "String_Node_Str" + "String_Node_Str"+ type);
      return;
    }
    clusterCreate.setType(clusterType);
  }
 else   if (specFilePath == null) {
    clusterCreate.setType(ClusterType.HDFS_MAPRED);
  }
  if (topology != null) {
    try {
      clusterCreate.setTopologyPolicy(TopologyType.valueOf(topology));
    }
 catch (    IllegalArgumentException ex) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INVALID_VALUE + "String_Node_Str" + "String_Node_Str"+ topology);
      return;
    }
  }
 else {
    clusterCreate.setTopologyPolicy(TopologyType.NONE);
  }
  try {
    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;
      }
    }
 else {
      String defaultDistroName=clusterCreate.getDefaultDistroName(distroRestClient.getAll());
      if (CommandsUtils.isBlank(defaultDistroName)) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM__NO_DEFAULT_DISTRO);
        return;
      }
 else {
        clusterCreate.setDistro(defaultDistroName);
      }
    }
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
  DistroRead distroRead=distroRestClient.get(clusterCreate.getDistro());
  clusterCreate.setDistroVendor(distroRead.getVendor());
  clusterCreate.setDistroVersion(distroRead.getVersion());
  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> failedMsgList=new ArrayList<String>();
  List<String> warningMsgList=new ArrayList<String>();
  List<String> networkNames=null;
  try {
    if (specFilePath != null) {
      ClusterCreate clusterSpec=CommandsUtils.getObjectByJsonString(ClusterCreate.class,CommandsUtils.dataFromFile(specFilePath));
      clusterCreate.setSpecFile(true);
      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;
      }
    }
    networkNames=getNetworkNames();
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
  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;
      }
    }
  }
  clusterCreate.validateCDHVersion(warningMsgList);
  if (specFilePath != null && !clusterCreate.getDistro().equalsIgnoreCase(com.vmware.bdd.utils.Constants.MAPR_VENDOR)) {
    List<String> distroRoles=findDistroRoles(clusterCreate);
    clusterCreate.validateClusterCreate(failedMsgList,warningMsgList,distroRoles);
  }
  if (type != null && specFilePath != null) {
    warningMsgList.add(Constants.TYPE_SPECFILE_CONFLICT);
  }
  if (!failedMsgList.isEmpty()) {
    showFailedMsg(clusterCreate.getName(),failedMsgList);
    return;
  }
  try {
    if (!CommandsUtils.showWarningMsg(clusterCreate.getName(),Constants.OUTPUT_OBJECT_CLUSTER,Constants.OUTPUT_OP_CREATE,warningMsgList,alwaysAnswerYes)) {
      return;
    }
    restClient.create(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,CommandsUtils.getExceptionMessage(e));
  }
}