nus-yam/ex-repair huggingface dataset:
Program: 49131
Project: 49131
Buggy source:
public ResourcePoolRead toRest(){
  ResourcePoolRead read=new ResourcePoolRead();
  read.setRpName(this.getName());
  read.setRpVsphereName(this.getVcResourcePool());
  read.setVcCluster(this.getVcCluster());
  Set<HadoopNodeEntity> nodes=this.getHadoopNodes();
  if (nodes == null || nodes.isEmpty()) {
    return read;
  }
  List<NodeRead> nodeReads=new ArrayList<NodeRead>();
  for (  HadoopNodeEntity node : nodes) {
    NodeRead nodeRead=node.toNodeRead();
    nodeReads.add(nodeRead);
  }
  Collections.sort(nodeReads,new Comparator<NodeRead>(){
    public int compare(    NodeRead arg0,    NodeRead arg1){
      return arg0.getName().compareTo(arg1.getName());
    }
  }
);
  read.setNodes(nodeReads.toArray(new NodeRead[]{}));
  return read;
}

Fixed version (ground truth):
public ResourcePoolRead toRest(){
  ResourcePoolRead read=new ResourcePoolRead();
  read.setRpName(this.getName());
  read.setRpVsphereName(this.getVcResourcePool());
  read.setVcCluster(this.getVcCluster());
  Set<HadoopNodeEntity> nodes=this.getHadoopNodes();
  if (nodes == null || nodes.isEmpty()) {
    return read;
  }
  List<NodeRead> nodeReads=new ArrayList<NodeRead>();
  for (  HadoopNodeEntity node : nodes) {
    NodeRead nodeRead=node.toNodeRead();
    nodeReads.add(nodeRead);
  }
  Collections.sort(nodeReads,new Comparator<NodeRead>(){
    public int compare(    NodeRead arg0,    NodeRead arg1){
      return arg0.getName().compareTo(arg1.getName());
    }
  }
);
  read.setNodes(nodeReads.toArray(new NodeRead[nodeReads.size()]));
  return read;
}
Program: 49133
Project: 49133
Buggy source:
private Set<NodeGroupEntity> convertNodeGroupsToEntities(Gson gson,ClusterEntity clusterEntity,String distro,NodeGroupCreate[] groups,EnumSet<HadoopRole> allRoles,boolean validateWhiteList){
  Set<NodeGroupEntity> nodeGroups;
  nodeGroups=new HashSet<NodeGroupEntity>();
  for (  NodeGroupCreate group : groups) {
    NodeGroupEntity groupEntity=convertGroup(gson,clusterEntity,allRoles,group,distro,validateWhiteList);
    groupEntity.setVmFolderPath(clusterEntity);
    if (groupEntity != null) {
      nodeGroups.add(groupEntity);
    }
  }
  return nodeGroups;
}

Fixed version (ground truth):
private Set<NodeGroupEntity> convertNodeGroupsToEntities(Gson gson,ClusterEntity clusterEntity,String distro,NodeGroupCreate[] groups,EnumSet<HadoopRole> allRoles,boolean validateWhiteList){
  Set<NodeGroupEntity> nodeGroups;
  nodeGroups=new HashSet<NodeGroupEntity>();
  for (  NodeGroupCreate group : groups) {
    NodeGroupEntity groupEntity=convertGroup(gson,clusterEntity,allRoles,group,distro,validateWhiteList);
    if (groupEntity != null) {
      nodeGroups.add(groupEntity);
    }
  }
  return nodeGroups;
}
Program: 49135
Project: 49135
Buggy source:
private String readDistroManifest() throws IOException {
  URL manifestUrl=new URL(distrosManifestUrl);
  BufferedReader in=new BufferedReader(new InputStreamReader(manifestUrl.openStream()));
  StringBuffer sb=new StringBuffer();
  String line;
  while ((line=in.readLine()) != null) {
    sb.append(line);
  }
  in.close();
  return sb.toString();
}

Fixed version (ground truth):
private String readDistroManifest() throws IOException {
  URL manifestUrl=new URL(distrosManifestUrl);
  BufferedReader in=null;
  try {
    in=new BufferedReader(new InputStreamReader(manifestUrl.openStream()));
    StringBuffer sb=new StringBuffer();
    String line;
    while ((line=in.readLine()) != null) {
      sb.append(line);
    }
    return sb.toString();
  }
  finally {
    if (in != null) {
      in.close();
    }
  }
}
Program: 49136
Project: 49136
Buggy source:
/** 
 * Generate a weak (non-standard) UUID string based on current time, parameters and pseudo random number.
 * @param params list of parameters
 * @return UUID string
 */
private static String generateCookie(Object... params){
  long timestamp=System.currentTimeMillis();
  long rand=new Random().nextInt();
  long hash=0;
  for (  Object p : params) {
    if (p != null) {
      hash^=p.hashCode();
    }
  }
  return new UUID((hash << 32) | (rand & 0xFFFFFFFFL),timestamp).toString();
}

Fixed version (ground truth):
/** 
 * Generate a weak (non-standard) UUID string based on current time, parameters and pseudo random number.
 * @param params list of parameters
 * @return UUID string
 */
private static String generateCookie(Object... params){
  long timestamp=System.currentTimeMillis();
  long rand=random.nextInt();
  long hash=0;
  for (  Object p : params) {
    if (p != null) {
      hash^=p.hashCode();
    }
  }
  return new UUID((hash << 32) | (rand & 0xFFFFFFFFL),timestamp).toString();
}
Program: 49137
Project: 49137
Buggy source:
public Set<String> getDatastoresByName(String name){
  List<VcDataStoreEntity> datastores=VcDataStoreEntity.findByName(name);
  if (datastores == null) {
    logger.warn("String_Node_Str" + name);
  }
  return getDatastorePattern(datastores);
}

Fixed version (ground truth):
public Set<String> getDatastoresByName(String name){
  List<VcDataStoreEntity> datastores=VcDataStoreEntity.findByName(name);
  return getDatastorePattern(datastores);
}
Program: 49138
Project: 49138
Buggy source:
private Set<String> getAllDatastoresByTypeAndName(DatastoreType type,String name){
  List<VcDataStoreEntity> datastores=VcDataStoreEntity.findByNameAndType(type,name);
  if (datastores == null) {
    logger.warn("String_Node_Str" + name + "String_Node_Str"+ type);
  }
  Set<String> result=getDatastorePattern(datastores);
  logger.debug("String_Node_Str" + type + "String_Node_Str"+ name+ result);
  return result;
}

Fixed version (ground truth):
private Set<String> getAllDatastoresByTypeAndName(DatastoreType type,String name){
  List<VcDataStoreEntity> datastores=VcDataStoreEntity.findByNameAndType(type,name);
  Set<String> result=getDatastorePattern(datastores);
  logger.debug("String_Node_Str" + type + "String_Node_Str"+ name+ result);
  return result;
}
Program: 49139
Project: 49139
Buggy source:
public List<VcCluster> getVcResourcePoolByNameList(String[] names){
  logger.debug("String_Node_Str" + names);
  if (names == null || names.length == 0) {
    return null;
  }
  Map<String,VcCluster> clusterMap=new HashMap<String,VcCluster>();
  for (  String name : names) {
    VcResourcePoolEntity rpForName=VcResourcePoolEntity.findByName(name);
    if (rpForName == null) {
      logger.warn("String_Node_Str" + name + "String_Node_Str");
      continue;
    }
    combineCluster(clusterMap,rpForName);
  }
  if (clusterMap.values().isEmpty()) {
    throw VcProviderException.NO_RESOURCE_POOL_FOUND(names);
  }
  List<VcCluster> result=new ArrayList<VcCluster>();
  result.addAll(clusterMap.values());
  logger.debug("String_Node_Str" + result);
  return result;
}

Fixed version (ground truth):
public List<VcCluster> getVcResourcePoolByNameList(String[] names){
  logger.debug("String_Node_Str" + Arrays.toString(names));
  if (names == null || names.length == 0) {
    return null;
  }
  Map<String,VcCluster> clusterMap=new HashMap<String,VcCluster>();
  for (  String name : names) {
    VcResourcePoolEntity rpForName=VcResourcePoolEntity.findByName(name);
    if (rpForName == null) {
      logger.warn("String_Node_Str" + name + "String_Node_Str");
      continue;
    }
    combineCluster(clusterMap,rpForName);
  }
  if (clusterMap.values().isEmpty()) {
    throw VcProviderException.NO_RESOURCE_POOL_FOUND(names);
  }
  List<VcCluster> result=new ArrayList<VcCluster>();
  result.addAll(clusterMap.values());
  logger.debug("String_Node_Str" + result);
  return result;
}
Program: 49143
Project: 49143
Buggy source:
public Long startCluster(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
  if (cluster == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (ClusterStatus.RUNNING.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw ClusterManagerException.ALREADY_STARTED_ERROR(clusterName);
  }
  if (!ClusterStatus.STOPPED.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.START_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  StartClusterListener listener=new StartClusterListener(clusterName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.STARTING);
}

Fixed version (ground truth):
public Long startCluster(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
  if (cluster == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (ClusterStatus.RUNNING.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw ClusterManagerException.ALREADY_STARTED_ERROR(clusterName);
  }
  if (!ClusterStatus.STOPPED.equals(cluster.getStatus()) && !ClusterStatus.ERROR.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.START_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  StartClusterListener listener=new StartClusterListener(clusterName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.STARTING);
}
Program: 49145
Project: 49145
Buggy source:
public Long stopCluster(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
  if (cluster == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (ClusterStatus.STOPPED.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw ClusterManagerException.ALREADY_STOPPED_ERROR(clusterName);
  }
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.STOP_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  StopClusterListener listener=new StopClusterListener(clusterName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.STOPPING);
}

Fixed version (ground truth):
public Long stopCluster(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
  if (cluster == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (ClusterStatus.STOPPED.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw ClusterManagerException.ALREADY_STOPPED_ERROR(clusterName);
  }
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus()) && !ClusterStatus.ERROR.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.STOP_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  StopClusterListener listener=new StopClusterListener(clusterName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.STOPPING);
}
Program: 49146
Project: 49146
Buggy source:
@Override public void onFailure(){
  logger.debug("String_Node_Str");
  DAL.inRwTransactionDo(new Saveable<Void>(){
    @Override public Void body() throws Exception {
      ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
      AuAssert.check(cluster != null);
      NodeGroupEntity group=NodeGroupEntity.findNodeGroupEntityByName(cluster,nodeGroupName);
      AuAssert.check(group != null);
      cluster.setStatus(ClusterStatus.RUNNING);
      group.setDefineInstanceNum(oldInstanceNum);
      logger.error("String_Node_Str" + clusterName + "String_Node_Str");
      Set<HadoopNodeEntity> toRemove=new HashSet<HadoopNodeEntity>();
      if (group.getHadoopNodes() != null) {
        for (        HadoopNodeEntity node : group.getHadoopNodes()) {
          if (ClusterCmdUtil.getIndexFromNodeName(node.getVmName()) >= oldInstanceNum) {
            logger.info("String_Node_Str" + node.getVmName());
            toRemove.add(node);
            DAL.delete(node);
          }
        }
        group.getHadoopNodes().removeAll(toRemove);
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
@Override public void onFailure(){
  logger.debug("String_Node_Str");
  DAL.inRwTransactionDo(new Saveable<Void>(){
    @Override public Void body() throws Exception {
      ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
      AuAssert.check(cluster != null);
      cluster.setStatus(ClusterStatus.RUNNING);
      logger.error("String_Node_Str" + clusterName + "String_Node_Str");
      return null;
    }
  }
);
}
Program: 49147
Project: 49147
Buggy source:
public UpdateClusterListener(String clusterName,String nodeGroupName,int oldInstanceNum){
  super();
  this.clusterName=clusterName;
  this.nodeGroupName=nodeGroupName;
  this.oldInstanceNum=oldInstanceNum;
}

Fixed version (ground truth):
public UpdateClusterListener(String clusterName){
  super();
  this.clusterName=clusterName;
}
Program: 49148
Project: 49148
Buggy source:
@Override public Void body() throws Exception {
  ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
  AuAssert.check(cluster != null);
  NodeGroupEntity group=NodeGroupEntity.findNodeGroupEntityByName(cluster,nodeGroupName);
  AuAssert.check(group != null);
  cluster.setStatus(ClusterStatus.RUNNING);
  group.setDefineInstanceNum(oldInstanceNum);
  logger.error("String_Node_Str" + clusterName + "String_Node_Str");
  Set<HadoopNodeEntity> toRemove=new HashSet<HadoopNodeEntity>();
  if (group.getHadoopNodes() != null) {
    for (    HadoopNodeEntity node : group.getHadoopNodes()) {
      if (ClusterCmdUtil.getIndexFromNodeName(node.getVmName()) >= oldInstanceNum) {
        logger.info("String_Node_Str" + node.getVmName());
        toRemove.add(node);
        DAL.delete(node);
      }
    }
    group.getHadoopNodes().removeAll(toRemove);
  }
  return null;
}

Fixed version (ground truth):
@Override public Void body() throws Exception {
  ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
  AuAssert.check(cluster != null);
  cluster.setStatus(ClusterStatus.RUNNING);
  logger.error("String_Node_Str" + clusterName + "String_Node_Str");
  return null;
}
Program: 49149
Project: 49149
Buggy source:
private List<RackInfo> readRackInfoFromFile(String filePath) throws IOException, FileNotFoundException, CliException {
  FileReader fileReader=null;
  BufferedReader reader=null;
  List<RackInfo> racksInfo=new ArrayList<RackInfo>();
  try {
    File f=new File(filePath);
    fileReader=new FileReader(f);
    reader=new BufferedReader(fileReader);
    String line="String_Node_Str";
    int lineNum=1;
    while ((line=reader.readLine()) != null) {
      line=line.trim();
      if (line.isEmpty()) {
        lineNum++;
        continue;
      }
 else {
        String[] rackHosts=line.split("String_Node_Str");
        if (rackHosts.length != 2) {
          throw new CliException("String_Node_Str" + lineNum + "String_Node_Str"+ Constants.TOPLOGY_FORMAT);
        }
 else {
          String[] hosts=rackHosts[1].split("String_Node_Str");
          for (int i=0; i < hosts.length; i++) {
            hosts[i]=hosts[i].trim();
          }
          RackInfo rackInfo=new RackInfo();
          rackInfo.setName(rackHosts[0].trim());
          rackInfo.setHosts(Arrays.asList(hosts));
          racksInfo.add(rackInfo);
        }
      }
    }
  }
  finally {
    if (reader != null) {
      reader.close();
    }
    if (fileReader != null) {
      fileReader.close();
    }
  }
  return racksInfo;
}

Fixed version (ground truth):
private List<RackInfo> readRackInfoFromFile(String filePath) throws IOException, FileNotFoundException, CliException {
  FileReader fileReader=null;
  BufferedReader reader=null;
  List<RackInfo> racksInfo=new ArrayList<RackInfo>();
  try {
    File f=new File(filePath);
    fileReader=new FileReader(f);
    reader=new BufferedReader(fileReader);
    String line="String_Node_Str";
    int lineNum=1;
    while ((line=reader.readLine()) != null) {
      line=line.trim();
      if (line.isEmpty()) {
        lineNum++;
        continue;
      }
 else {
        String[] rackHosts=line.split("String_Node_Str");
        if (rackHosts.length != 2 || rackHosts[0].trim().isEmpty() || rackHosts[1].trim().isEmpty()) {
          throw new CliException("String_Node_Str" + lineNum + "String_Node_Str"+ Constants.TOPLOGY_FORMAT);
        }
 else {
          String[] hosts=rackHosts[1].split("String_Node_Str");
          int numOfNonEmptyHosts=0;
          for (int i=0; i < hosts.length; i++) {
            hosts[i]=hosts[i].trim();
            if (!hosts[i].isEmpty()) {
              hosts[numOfNonEmptyHosts++]=hosts[i];
            }
          }
          if (numOfNonEmptyHosts == 0) {
            throw new CliException("String_Node_Str" + lineNum + "String_Node_Str"+ Constants.TOPLOGY_FORMAT);
          }
          RackInfo rackInfo=new RackInfo();
          rackInfo.setName(rackHosts[0].trim());
          rackInfo.setHosts(Arrays.asList(hosts).subList(0,numOfNonEmptyHosts));
          racksInfo.add(rackInfo);
        }
      }
    }
  }
  finally {
    if (reader != null) {
      reader.close();
    }
    if (fileReader != null) {
      fileReader.close();
    }
  }
  return racksInfo;
}
Program: 49150
Project: 49150
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void upload(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String fileName){
  try {
    List<RackInfo> racks=readRackInfoFromFile(fileName);
    topologyRestClient.upload(racks);
    CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_TOPOLOGY,null,Constants.OUTPUT_OP_RESULT_UPLOAD);
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_TOPOLOGY,null,Constants.OUTPUT_OP_UPLOAD,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void upload(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String fileName){
  try {
    List<RackInfo> racks=readRackInfoFromFile(fileName);
    if (!duplicatedNameCheck(racks)) {
      topologyRestClient.upload(racks);
      CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_TOPOLOGY,null,Constants.OUTPUT_OP_RESULT_UPLOAD);
    }
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_TOPOLOGY,null,Constants.OUTPUT_OP_UPLOAD,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    return;
  }
}
Program: 49152
Project: 49152
Buggy source:
public NodeGroupRead toNodeGroupRead(){
  NodeGroupRead nodeGroupRead=new NodeGroupRead();
  nodeGroupRead.setName(this.name);
  nodeGroupRead.setCpuNum(this.cpuNum);
  nodeGroupRead.setMemCapacityMB(this.memorySize);
  nodeGroupRead.setInstanceNum(this.getRealInstanceNum());
  nodeGroupRead.setRoles(this.getRoleNameList());
  StorageRead storage=new StorageRead();
  storage.setType(this.storageType.toString());
  storage.setSizeGB(this.storageSize);
  storage.setDsNames(getVcDatastoreNameList());
  nodeGroupRead.setStorage(storage);
  List<NodeRead> nodeList=new ArrayList<NodeRead>();
  for (  HadoopNodeEntity node : this.hadoopNodes) {
    nodeList.add(node.toNodeRead());
  }
  nodeGroupRead.setInstances(nodeList);
  List<GroupAssociation> associations=new ArrayList<GroupAssociation>();
  for (  NodeGroupAssociation relation : groupAssociations) {
    GroupAssociation association=new GroupAssociation();
    association.setReference(relation.getReferencedGroup());
    association.setType(relation.getAssociationType());
    associations.add(association);
  }
  PlacementPolicy policy=new PlacementPolicy();
  policy.setInstancePerHost(instancePerHost);
  policy.setGroupAssociations(associations);
  nodeGroupRead.setPlacementPolicies(policy);
  return nodeGroupRead;
}

Fixed version (ground truth):
public NodeGroupRead toNodeGroupRead(){
  NodeGroupRead nodeGroupRead=new NodeGroupRead();
  nodeGroupRead.setName(this.name);
  nodeGroupRead.setCpuNum(this.cpuNum);
  nodeGroupRead.setMemCapacityMB(this.memorySize);
  nodeGroupRead.setInstanceNum(this.getRealInstanceNum());
  nodeGroupRead.setRoles(this.getRoleNameList());
  StorageRead storage=new StorageRead();
  storage.setType(this.storageType.toString());
  storage.setSizeGB(this.storageSize);
  storage.setDsNames(getVcDatastoreNameList());
  nodeGroupRead.setStorage(storage);
  List<NodeRead> nodeList=new ArrayList<NodeRead>();
  for (  HadoopNodeEntity node : this.hadoopNodes) {
    nodeList.add(node.toNodeRead());
  }
  nodeGroupRead.setInstances(nodeList);
  List<GroupAssociation> associations=new ArrayList<GroupAssociation>();
  for (  NodeGroupAssociation relation : groupAssociations) {
    GroupAssociation association=new GroupAssociation();
    association.setReference(relation.getReferencedGroup());
    association.setType(relation.getAssociationType());
    associations.add(association);
  }
  PlacementPolicy policy=new PlacementPolicy();
  policy.setInstancePerHost(instancePerHost);
  policy.setGroupAssociations(associations);
  policy.setGroupRacks((GroupRacks)new Gson().fromJson(groupRacks,GroupRacks.class));
  nodeGroupRead.setPlacementPolicies(policy);
  return nodeGroupRead;
}
Program: 49153
Project: 49153
Buggy source:
public Long deleteClusterByName(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus()) && !ClusterStatus.STOPPED.equals(cluster.getStatus()) && !ClusterStatus.ERROR.equals(cluster.getStatus())&& !ClusterStatus.PROVISION_ERROR.equals(cluster.getStatus())&& !ClusterStatus.CONFIGURE_ERROR.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.DELETION_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  DeleteClusterListener listener=new DeleteClusterListener(clusterName,networkManager);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.DELETING);
}

Fixed version (ground truth):
public Long deleteClusterByName(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus()) && !ClusterStatus.STOPPED.equals(cluster.getStatus()) && !ClusterStatus.ERROR.equals(cluster.getStatus())&& !ClusterStatus.PROVISION_ERROR.equals(cluster.getStatus())&& !ClusterStatus.CONFIGURE_ERROR.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.DELETION_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  if (!checkClusterInstance(clusterName)) {
    return null;
  }
  DeleteClusterListener listener=new DeleteClusterListener(clusterName,networkManager);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.DELETING);
}
Program: 49154
Project: 49154
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.DELETE) @ResponseStatus(HttpStatus.ACCEPTED) public void deleteCluster(@PathVariable("String_Node_Str") String clusterName,HttpServletRequest request,HttpServletResponse response) throws Exception {
  Long taskId=clusterMgr.deleteClusterByName(clusterName);
  redirectRequest(taskId,request,response);
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.DELETE) @ResponseStatus(HttpStatus.ACCEPTED) public void deleteCluster(@PathVariable("String_Node_Str") String clusterName,HttpServletRequest request,HttpServletResponse response) throws Exception {
  Long taskId=clusterMgr.deleteClusterByName(clusterName);
  if (taskId == null) {
    return;
  }
  redirectRequest(taskId,request,response);
}
Program: 49155
Project: 49155
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void limitCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String clusterName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeGroupName,@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final int activeComputeNodeNum){
  try {
    if (!validateLimit(clusterName,nodeGroupName,activeComputeNodeNum)) {
      return;
    }
    restClient.limitCluster(clusterName,nodeGroupName,activeComputeNodeNum);
    CommandsUtils.printCmdSuccess(Constants.OUTPUT_OP_ADJUSTMENT,null,Constants.OUTPUT_OP_ADJUSTMENT_SUCCEEDED);
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OP_ADJUSTMENT,null,null,Constants.OUTPUT_OP_ADJUSTMENT_FAILED,e.getMessage());
  }
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void limitCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String clusterName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeGroupName,@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final int activeComputeNodeNum){
  try {
    if (activeComputeNodeNum < 0) {
      System.out.println("String_Node_Str" + activeComputeNodeNum);
      return;
    }
    ClusterRead cluster=restClient.get(clusterName);
    if (cluster == null) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OP_ADJUSTMENT,null,null,Constants.OUTPUT_OP_ADJUSTMENT_FAILED,"String_Node_Str" + clusterName + "String_Node_Str");
      return;
    }
    if (!cluster.validateLimit(nodeGroupName,activeComputeNodeNum)) {
      return;
    }
    restClient.limitCluster(clusterName,nodeGroupName,activeComputeNodeNum);
    CommandsUtils.printCmdSuccess(Constants.OUTPUT_OP_ADJUSTMENT,null,Constants.OUTPUT_OP_ADJUSTMENT_SUCCEEDED);
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OP_ADJUSTMENT,null,null,Constants.OUTPUT_OP_ADJUSTMENT_FAILED,e.getMessage());
  }
}
Program: 49156
Project: 49156
Buggy source:
/** 
 * Check whether the given String has actual text. More specifically, returns <code>false</code> if the string not <code>null</code>, its length is greater than 0, and it contains at least one non-whitespace character. <p> <pre> CommandsUtils.isBlank(null) = true CommandsUtils.isBlank("") = true CommandsUtils.isBlank(" ") = true CommandsUtils.isBlank("12345") = false CommandsUtils.isBlank(" 12345 ") = false </pre>
 * @param str the String to check(may be null).
 * @return the opposite of
 */
public static boolean isBlank(final String str){
  return str == null || str.trim().isEmpty();
}

Fixed version (ground truth):
/** 
 * Check whether the given String has actual text. More specifically, returns <code>false</code> if the string not <code>null</code>, its length is greater than 0, and it contains at least one non-whitespace character. <p> <pre> CommandsUtils.isBlank(null) = true CommandsUtils.isBlank("") = true CommandsUtils.isBlank(" ") = true CommandsUtils.isBlank("12345") = false CommandsUtils.isBlank(" 12345 ") = false </pre>
 * @param str the String to check(may be null).
 * @return the opposite of
 */
public static boolean isBlank(final String str){
  return CommonUtil.isBlank(str);
}
Program: 49157
Project: 49157
Buggy source:
public void limitCluster(String clusterName,String nodeGroupName,int activeComputeNodeNum){
  final String path=Constants.REST_PATH_CLUSTER + "String_Node_Str" + clusterName+ "String_Node_Str"+ "String_Node_Str";
  final HttpMethod httpverb=HttpMethod.PUT;
  PrettyOutput outputCallBack=getClusterPrettyOutputCallBack(this,clusterName);
  NodeGroupRead nodeGroup=new NodeGroupRead();
  nodeGroup.setInstanceNum(activeComputeNodeNum);
  nodeGroup.setName(nodeGroupName);
  restClient.update(nodeGroup,path,httpverb,outputCallBack);
}

Fixed version (ground truth):
public void limitCluster(String clusterName,String nodeGroupName,int activeComputeNodeNum){
  final String path=Constants.REST_PATH_CLUSTER + "String_Node_Str" + clusterName+ "String_Node_Str"+ "String_Node_Str";
  final HttpMethod httpverb=HttpMethod.PUT;
  PrettyOutput outputCallBack=getClusterPrettyOutputCallBack(this,clusterName);
  VHMRequestBody requestBody=new VHMRequestBody();
  requestBody.setActiveComputeNodeNum(activeComputeNodeNum);
  requestBody.setNodeGroupName(nodeGroupName);
  restClient.update(requestBody,path,httpverb,outputCallBack);
}
Program: 49161
Project: 49161
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void conn(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String hostName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String username,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String password){
  Map<String,String> loginInfo=new HashMap<String,String>();
  loginInfo.put("String_Node_Str",username);
  loginInfo.put("String_Node_Str",password);
  try {
    if (CommandsUtils.isBlank(username)) {
      if (!prompt(Constants.CONNECT_ENTER_USER_NAME,PromptType.USER_NAME,loginInfo)) {
        return;
      }
    }
    if (CommandsUtils.isBlank(password)) {
      if (!prompt(Constants.CONNECT_ENTER_PASSWORD,PromptType.PASSWORD,loginInfo)) {
        return;
      }
    }
    connect(hostName,loginInfo,3);
  }
 catch (  CliRestException e) {
    System.out.println();
    printConnectionFailure(e.getMessage());
  }
catch (  Exception e) {
    printConnectionFailure(e.getMessage());
  }
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void conn(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String hostName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String username,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String password){
  Map<String,String> loginInfo=new HashMap<String,String>();
  loginInfo.put("String_Node_Str",username);
  loginInfo.put("String_Node_Str",password);
  try {
    if (CommandsUtils.isBlank(username)) {
      if (!prompt(Constants.CONNECT_ENTER_USER_NAME,PromptType.USER_NAME,loginInfo)) {
        return;
      }
    }
    if (CommandsUtils.isBlank(password)) {
      if (!prompt(Constants.CONNECT_ENTER_PASSWORD,PromptType.PASSWORD,loginInfo)) {
        return;
      }
    }
    connect(hostName,loginInfo,3);
  }
 catch (  Exception e) {
    System.out.println();
    printConnectionFailure(e.getMessage());
  }
}
Program: 49162
Project: 49162
Buggy source:
private String readEnter(String msg,PromptType promptType){
  String enter="String_Node_Str";
  BufferedReader br=null;
  try {
    br=new BufferedReader(new InputStreamReader(System.in));
    ConsoleReader reader=new ConsoleReader(System.in,new PrintWriter(System.out));
    int times=0;
    while (!br.ready() && times < Constants.MAX_WAITING_LOOP) {
      Thread.currentThread().sleep(Constants.READER_SLEEP_TIME_MILLISECONDS);
      times++;
    }
    if (!br.ready()) {
      throw new CliRestException(Constants.READ_TIME_OUT);
    }
    if (promptType == PromptType.USER_NAME) {
      enter=reader.readLine();
    }
 else     if (promptType == PromptType.PASSWORD) {
      enter=reader.readLine(new Character('*'));
    }
  }
 catch (  CliRestException e) {
    throw e;
  }
catch (  Exception e) {
    throw new CliRestException(e.getMessage());
  }
  return enter;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private String readEnter(String msg,PromptType promptType) throws Exception {
  String enter="String_Node_Str";
  BufferedReader br=null;
  br=new BufferedReader(new InputStreamReader(System.in));
  ConsoleReader reader=new ConsoleReader(System.in,new PrintWriter(System.out));
  int times=0;
  while (!br.ready() && times < Constants.MAX_WAITING_LOOP) {
    Thread.currentThread().sleep(Constants.READER_SLEEP_TIME_MILLISECONDS);
    times++;
  }
  if (!br.ready()) {
    throw new Exception(Constants.READ_TIME_OUT);
  }
  if (promptType == PromptType.USER_NAME) {
    enter=reader.readLine();
  }
 else   if (promptType == PromptType.PASSWORD) {
    enter=reader.readLine(new Character('*'));
  }
  return enter;
}
Program: 49163
Project: 49163
Buggy source:
private boolean prompt(String msg,PromptType promptType,Map<String,String> loginInfo){
  int k=0;
  String enter="String_Node_Str";
  while (k < 3) {
    System.out.print(msg);
    enter=readEnter(msg,promptType);
    if (!CommandsUtils.isBlank(enter)) {
      if (promptType == PromptType.USER_NAME) {
        loginInfo.put("String_Node_Str",enter);
      }
 else {
        loginInfo.put("String_Node_Str",enter);
      }
      break;
    }
 else {
      StringBuilder warningMsg=new StringBuilder();
      if (promptType == PromptType.USER_NAME) {
        warningMsg.append(Constants.CONNECT_USER_NAME);
      }
 else {
        warningMsg.append(Constants.CONNECT_PASSWORD);
      }
      warningMsg.append(Constants.CONNECT_CAN_NOT_BE_NULL);
      System.out.println(warningMsg.toString());
    }
    k++;
  }
  return k < 3;
}

Fixed version (ground truth):
private boolean prompt(String msg,PromptType promptType,Map<String,String> loginInfo) throws Exception {
  int k=0;
  String enter="String_Node_Str";
  while (k < 3) {
    System.out.print(msg);
    enter=readEnter(msg,promptType);
    if (!CommandsUtils.isBlank(enter)) {
      if (promptType == PromptType.USER_NAME) {
        loginInfo.put("String_Node_Str",enter);
      }
 else {
        loginInfo.put("String_Node_Str",enter);
      }
      break;
    }
 else {
      StringBuilder warningMsg=new StringBuilder();
      if (promptType == PromptType.USER_NAME) {
        warningMsg.append(Constants.CONNECT_USER_NAME);
      }
 else {
        warningMsg.append(Constants.CONNECT_PASSWORD);
      }
      warningMsg.append(Constants.CONNECT_CAN_NOT_BE_NULL);
      System.out.println(warningMsg.toString());
    }
    k++;
  }
  return k < 3;
}
Program: 49164
Project: 49164
Buggy source:
private boolean connect(final String hostName,final Map<String,String> loginInfo,int count){
  if (count <= 0) {
    return false;
  }
 else {
    ConnectType connectType=conn.connect(hostName,loginInfo.get("String_Node_Str"),loginInfo.get("String_Node_Str"));
    if (connectType == ConnectType.UNAUTHORIZATION) {
      if (!prompt(Constants.CONNECT_ENTER_PASSWORD,PromptType.PASSWORD,loginInfo)) {
        return false;
      }
 else {
        count--;
        connect(hostName,loginInfo,count);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean connect(final String hostName,final Map<String,String> loginInfo,int count) throws Exception {
  if (count <= 0) {
    return false;
  }
 else {
    ConnectType connectType=conn.connect(hostName,loginInfo.get("String_Node_Str"),loginInfo.get("String_Node_Str"));
    if (connectType == ConnectType.UNAUTHORIZATION) {
      if (!prompt(Constants.CONNECT_ENTER_PASSWORD,PromptType.PASSWORD,loginInfo)) {
        return false;
      }
 else {
        count--;
        connect(hostName,loginInfo,count);
      }
    }
  }
  return true;
}
Program: 49166
Project: 49166
Buggy source:
public void handleError(ClientHttpResponse response) throws IOException {
  MediaType contentType=response.getHeaders().getContentType();
  if (contentType == MediaType.APPLICATION_JSON) {
    throw new CliRestException(delegate.extractData(response).getMessage());
  }
 else {
    HttpStatus statusCode=response.getStatusCode();
    String errorMsg="String_Node_Str";
    if (statusCode == HttpStatus.UNAUTHORIZED) {
      errorMsg=Constants.CONNECT_SESSION_TIME_OUT;
    }
 else {
      errorMsg=statusCode.getReasonPhrase();
    }
    throw new CliRestException(statusCode,errorMsg);
  }
}

Fixed version (ground truth):
public void handleError(ClientHttpResponse response) throws IOException {
  MediaType contentType=response.getHeaders().getContentType();
  if (contentType.equals(MediaType.APPLICATION_JSON)) {
    throw new CliRestException(delegate.extractData(response).getMessage());
  }
 else {
    HttpStatus statusCode=response.getStatusCode();
    String errorMsg="String_Node_Str";
    if (statusCode == HttpStatus.UNAUTHORIZED) {
      errorMsg=Constants.CONNECT_SESSION_TIME_OUT;
    }
 else {
      errorMsg=statusCode.getReasonPhrase();
    }
    throw new CliRestException(statusCode,errorMsg);
  }
}
Program: 49167
Project: 49167
Buggy source:
private void createDefalutFile(ClusterCreate cluster){
  String origFile="String_Node_Str";
  String destFile=System.getProperty("String_Node_Str") + "String_Node_Str" + cluster.getName()+ "String_Node_Str";
  StringBuilder createDefalutFileMsgBuffer=new StringBuilder();
  try {
    CommonUtil.copyFile(origFile,destFile);
    createDefalutFileMsgBuffer.append("String_Node_Str").append(destFile).append("String_Node_Str").append(cluster.getName()).append("String_Node_Str");
    System.out.println(createDefalutFileMsgBuffer.toString());
  }
 catch (  IOException e) {
    CommonUtil.deleteFile(destFile);
  }
}

Fixed version (ground truth):
private void createDefalutFile(String clusterName){
  String origFile="String_Node_Str";
  String destFile=System.getProperty("String_Node_Str") + "String_Node_Str" + clusterName+ "String_Node_Str";
  StringBuilder createDefalutFileMsgBuffer=new StringBuilder();
  try {
    CommonUtil.copyFile(origFile,destFile);
    createDefalutFileMsgBuffer.append("String_Node_Str").append(destFile).append("String_Node_Str").append(clusterName).append("String_Node_Str");
    System.out.println(createDefalutFileMsgBuffer.toString());
  }
 catch (  IOException e) {
    CommonUtil.deleteFile(destFile);
  }
}
Program: 49168
Project: 49168
Buggy source:
private void resumeCreateCluster(final String name){
  Map<String,String> queryStrings=new HashMap<String,String>();
  queryStrings.put(Constants.QUERY_ACTION_KEY,Constants.QUERY_ACTION_RESUME);
  try {
    restClient.actionOps(name,queryStrings);
    CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESULT_RESUME);
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESUME,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
  }
}

Fixed version (ground truth):
private void resumeCreateCluster(final String name){
  Map<String,String> queryStrings=new HashMap<String,String>();
  queryStrings.put(Constants.QUERY_ACTION_KEY,Constants.QUERY_ACTION_RESUME);
  try {
    ClusterRead cluster=restClient.get(name);
    restClient.actionOps(name,queryStrings);
    if (cluster != null && cluster.isDefault()) {
      createDefalutFile(name);
    }
    CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESULT_RESUME);
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESUME,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
  }
}
Program: 49170
Project: 49170
Buggy source:
@Test public void testResumeCreateClusterFailure() throws Exception {
  BddErrorMessage errorMsg=new BddErrorMessage();
  errorMsg.setMessage("String_Node_Str");
  ObjectMapper mapper=new ObjectMapper();
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.PUT,HttpStatus.NOT_FOUND,mapper.writeValueAsString(errorMsg));
  clusterCommands.createCluster("String_Node_Str","String_Node_Str",null,null,null,null,true,false,false);
}

Fixed version (ground truth):
@Test public void testResumeCreateClusterFailure() throws Exception {
  ClusterRead cluster=buildClusterRead();
  BddErrorMessage errorMsg=new BddErrorMessage();
  errorMsg.setMessage("String_Node_Str");
  ObjectMapper mapper=new ObjectMapper();
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(cluster));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.PUT,HttpStatus.NOT_FOUND,mapper.writeValueAsString(errorMsg));
  clusterCommands.createCluster("String_Node_Str","String_Node_Str",null,null,null,null,true,false,false);
}
Program: 49171
Project: 49171
Buggy source:
@Test public void testResumeCreateCluster() throws Exception {
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.PUT,HttpStatus.NO_CONTENT,"String_Node_Str");
  clusterCommands.createCluster("String_Node_Str",null,null,null,null,null,true,false,false);
}

Fixed version (ground truth):
@Test public void testResumeCreateCluster() throws Exception {
  ObjectMapper mapper=new ObjectMapper();
  ClusterRead cluster=buildClusterRead();
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(cluster));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.PUT,HttpStatus.NO_CONTENT,"String_Node_Str");
  clusterCommands.createCluster("String_Node_Str",null,null,null,null,null,true,false,false);
}
Program: 49173
Project: 49173
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void startCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String clusterName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeGroupName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeName){
  Map<String,String> queryStrings=new HashMap<String,String>();
  queryStrings.put(Constants.QUERY_ACTION_KEY,Constants.QUERY_ACTION_START);
  try {
    String fullNodeName=autoCompleteNodeName(clusterName,nodeGroupName,nodeName);
    String resource=getClusterResourceName(clusterName,nodeGroupName,fullNodeName);
    if (resource != null) {
      restClient.actionOps(resource,queryStrings);
      CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER,clusterName,Constants.OUTPUT_OP_RESULT_START);
    }
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER,clusterName,Constants.OUTPUT_OP_START,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
  }
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void startCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String clusterName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeGroupName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeName){
  Map<String,String> queryStrings=new HashMap<String,String>();
  queryStrings.put(Constants.QUERY_ACTION_KEY,Constants.QUERY_ACTION_START);
  try {
    String fullNodeName=autoCompleteNodeName(clusterName,nodeGroupName,nodeName);
    String resource=getClusterResourceName(clusterName,nodeGroupName,fullNodeName);
    if (resource != null) {
      restClient.actionOps(resource,clusterName,queryStrings);
      CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER,clusterName,Constants.OUTPUT_OP_RESULT_START);
    }
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER,clusterName,Constants.OUTPUT_OP_START,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
  }
}
Program: 49174
Project: 49174
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void stopCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String clusterName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeGroupName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeName){
  Map<String,String> queryStrings=new HashMap<String,String>();
  queryStrings.put(Constants.QUERY_ACTION_KEY,Constants.QUERY_ACTION_STOP);
  try {
    String fullNodeName=autoCompleteNodeName(clusterName,nodeGroupName,nodeName);
    String resource=getClusterResourceName(clusterName,nodeGroupName,fullNodeName);
    if (resource != null) {
      restClient.actionOps(resource,queryStrings);
      CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER,clusterName,Constants.OUTPUT_OP_RESULT_STOP);
    }
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER,clusterName,Constants.OUTPUT_OP_STOP,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
  }
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void stopCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String clusterName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeGroupName,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") final String nodeName){
  Map<String,String> queryStrings=new HashMap<String,String>();
  queryStrings.put(Constants.QUERY_ACTION_KEY,Constants.QUERY_ACTION_STOP);
  try {
    String fullNodeName=autoCompleteNodeName(clusterName,nodeGroupName,nodeName);
    String resource=getClusterResourceName(clusterName,nodeGroupName,fullNodeName);
    if (resource != null) {
      restClient.actionOps(resource,clusterName,queryStrings);
      CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER,clusterName,Constants.OUTPUT_OP_RESULT_STOP);
    }
  }
 catch (  CliRestException e) {
    CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER,clusterName,Constants.OUTPUT_OP_STOP,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
  }
}
Program: 49175
Project: 49175
Buggy source:
public void actionOps(String id,Map<String,?> queryStrings){
  final String path=Constants.REST_PATH_CLUSTER;
  final HttpMethod httpverb=HttpMethod.PUT;
  PrettyOutput outputCallBack=getClusterPrettyOutputCallBack(this,id);
  restClient.actionOps(id,path,httpverb,queryStrings,outputCallBack);
}

Fixed version (ground truth):
public void actionOps(String id,Map<String,?> queryStrings){
  actionOps(id,id,queryStrings);
}