Program: 48888
Project: 48888
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 hdfsNetworkName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String mapredNetworkName,@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>();
  Set<String> allNetworkNames=new HashSet<String>();
  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;
      }
    }
    allNetworkNames=getAllNetworkNames();
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
  if (allNetworkNames.isEmpty()) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_CANNOT_FIND_NETWORK);
    return;
  }
  Map<NetTrafficType,List<String>> networkConfig=new HashMap<NetTrafficType,List<String>>();
  if (networkName == null) {
    if (allNetworkNames.size() == 1) {
      networkConfig.put(NetTrafficType.MGT_NETWORK,new ArrayList<String>());
      networkConfig.get(NetTrafficType.MGT_NETWORK).addAll(allNetworkNames);
    }
 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;
    }
  }
 else {
    if (!allNetworkNames.contains(networkName) || (hdfsNetworkName != null && !allNetworkNames.contains(hdfsNetworkName)) || (mapredNetworkName != null && !allNetworkNames.contains(mapredNetworkName))) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_NETWORK_NAME + Constants.PARAM_NOT_SUPPORTED + allNetworkNames.toString());
      return;
    }
    networkConfig.put(NetTrafficType.MGT_NETWORK,new ArrayList<String>());
    networkConfig.get(NetTrafficType.MGT_NETWORK).add(networkName);
    if (hdfsNetworkName != null) {
      networkConfig.put(NetTrafficType.HDFS_NETWORK,new ArrayList<String>());
      networkConfig.get(NetTrafficType.HDFS_NETWORK).add(hdfsNetworkName);
    }
    if (mapredNetworkName != null) {
      networkConfig.put(NetTrafficType.MAPRED_NETWORK,new ArrayList<String>());
      networkConfig.get(NetTrafficType.MAPRED_NETWORK).add(mapredNetworkName);
    }
  }
  notifyNetsUsage(networkConfig,warningMsgList);
  clusterCreate.setNetworkConfig(networkConfig);
  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));
  }
}

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 hdfsNetworkName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String mapredNetworkName,@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>();
  Set<String> allNetworkNames=new HashSet<String>();
  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);
      clusterCreate.validateNodeGroupNames();
      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;
      }
    }
    allNetworkNames=getAllNetworkNames();
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
  if (allNetworkNames.isEmpty()) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_CANNOT_FIND_NETWORK);
    return;
  }
  Map<NetTrafficType,List<String>> networkConfig=new HashMap<NetTrafficType,List<String>>();
  if (networkName == null) {
    if (allNetworkNames.size() == 1) {
      networkConfig.put(NetTrafficType.MGT_NETWORK,new ArrayList<String>());
      networkConfig.get(NetTrafficType.MGT_NETWORK).addAll(allNetworkNames);
    }
 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;
    }
  }
 else {
    if (!allNetworkNames.contains(networkName) || (hdfsNetworkName != null && !allNetworkNames.contains(hdfsNetworkName)) || (mapredNetworkName != null && !allNetworkNames.contains(mapredNetworkName))) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PARAM_NETWORK_NAME + Constants.PARAM_NOT_SUPPORTED + allNetworkNames.toString());
      return;
    }
    networkConfig.put(NetTrafficType.MGT_NETWORK,new ArrayList<String>());
    networkConfig.get(NetTrafficType.MGT_NETWORK).add(networkName);
    if (hdfsNetworkName != null) {
      networkConfig.put(NetTrafficType.HDFS_NETWORK,new ArrayList<String>());
      networkConfig.get(NetTrafficType.HDFS_NETWORK).add(hdfsNetworkName);
    }
    if (mapredNetworkName != null) {
      networkConfig.put(NetTrafficType.MAPRED_NETWORK,new ArrayList<String>());
      networkConfig.get(NetTrafficType.MAPRED_NETWORK).add(mapredNetworkName);
    }
  }
  notifyNetsUsage(networkConfig,warningMsgList);
  clusterCreate.setNetworkConfig(networkConfig);
  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));
  }
}