nus-yam/ex-repair huggingface dataset:
Program: 48332
Project: 48332
Buggy source:
@Override public boolean addNodeGroups(ClusterCreate clusterSpec,NodeGroupCreate[] nodeGroupsAdd,List<BaseNode> vNodes){
  boolean success=false;
  List<NodeGroupCreate> newNodeGroups=new ArrayList<NodeGroupCreate>();
  if (clusterSpec != null && clusterSpec.getNodeGroups() != null) {
    for (    NodeGroupCreate ng : clusterSpec.getNodeGroups()) {
      newNodeGroups.add(ng);
    }
  }
  if (nodeGroupsAdd != null) {
    for (    NodeGroupCreate ng : nodeGroupsAdd) {
      newNodeGroups.add(ng);
    }
  }
  if (clusterSpec != null) {
    clusterSpec.setNodeGroups(newNodeGroups.toArray(new NodeGroupCreate[newNodeGroups.size()]));
  }
  createVcFolders(clusterSpec,true);
  createVcResourcePools(vNodes,true);
  success=true;
  return success;
}

Fixed version (ground truth):
@Override public boolean addNodeGroups(ClusterCreate clusterSpec,NodeGroupCreate[] nodeGroupsAdd,List<BaseNode> vNodes){
  boolean success=false;
  List<NodeGroupCreate> newNodeGroups=new ArrayList<NodeGroupCreate>();
  if (clusterSpec != null && clusterSpec.getNodeGroups() != null) {
    for (    NodeGroupCreate ng : clusterSpec.getNodeGroups()) {
      newNodeGroups.add(ng);
    }
  }
  if (nodeGroupsAdd != null) {
    for (    NodeGroupCreate ng : nodeGroupsAdd) {
      newNodeGroups.add(ng);
    }
  }
  if (clusterSpec != null) {
    clusterSpec.setNodeGroups(newNodeGroups.toArray(new NodeGroupCreate[newNodeGroups.size()]));
  }
  if (null != createVcFolders(clusterSpec,true)) {
    if (null != createVcResourcePools(vNodes,true)) {
      success=true;
    }
  }
  return success;
}
Program: 48333
Project: 48333
Buggy source:
@SuppressWarnings("String_Node_Str") private Map<String,Folder> createVcFolders(ClusterCreate cluster,boolean addNodeGroup){
  logger.info("String_Node_Str");
  VcVirtualMachine templateVm=getTemplateVM(cluster.getTemplateName());
  Callable<Void>[] storeProcedures=new Callable[1];
  Folder clusterFolder=null;
  if (!addNodeGroup) {
    if (cluster.getNodeGroups().length > 0) {
      NodeGroupCreate group=cluster.getNodeGroups()[0];
      String path=group.getVmFolderPath();
      String[] folderNames=path.split("String_Node_Str");
      List<String> folderList=new ArrayList<String>();
      for (int i=0; i < folderNames.length - 1; i++) {
        folderList.add(folderNames[i]);
      }
      CreateVMFolderSP sp=new CreateVMFolderSP(templateVm.getDatacenter(),null,folderList);
      storeProcedures[0]=sp;
      Map<String,Folder> folders=executeFolderCreationProcedures(cluster,storeProcedures);
      for (      String name : folders.keySet()) {
        clusterFolder=folders.get(name);
        break;
      }
    }
  }
  logger.info("String_Node_Str");
  storeProcedures=new Callable[cluster.getNodeGroups().length];
  int i=0;
  for (  NodeGroupCreate group : cluster.getNodeGroups()) {
    List<String> folderList=new ArrayList<String>();
    folderList.add(group.getName());
    CreateVMFolderSP sp=new CreateVMFolderSP(templateVm.getDatacenter(),clusterFolder,folderList);
    storeProcedures[i]=sp;
    i++;
  }
  return executeFolderCreationProcedures(cluster,storeProcedures);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private Map<String,Folder> createVcFolders(ClusterCreate cluster,boolean addNodeGroup){
  logger.info("String_Node_Str");
  VcVirtualMachine templateVm=getTemplateVM(cluster.getTemplateName());
  Callable<Void>[] storeProcedures=new Callable[1];
  Folder clusterFolder=null;
  if (!addNodeGroup) {
    if (cluster.getNodeGroups().length > 0) {
      NodeGroupCreate group=cluster.getNodeGroups()[0];
      String path=group.getVmFolderPath();
      logger.info("String_Node_Str" + path);
      String[] folderNames=path.split("String_Node_Str");
      List<String> folderList=new ArrayList<String>();
      for (int i=0; i < folderNames.length - 1; i++) {
        folderList.add(folderNames[i]);
      }
      CreateVMFolderSP sp=new CreateVMFolderSP(templateVm.getDatacenter(),null,folderList);
      storeProcedures[0]=sp;
      Map<String,Folder> folders=executeFolderCreationProcedures(cluster,storeProcedures);
      for (      String name : folders.keySet()) {
        clusterFolder=folders.get(name);
        break;
      }
    }
  }
  logger.info("String_Node_Str");
  storeProcedures=new Callable[cluster.getNodeGroups().length];
  int i=0;
  for (  NodeGroupCreate group : cluster.getNodeGroups()) {
    List<String> folderList=new ArrayList<String>();
    folderList.add(group.getName());
    CreateVMFolderSP sp=new CreateVMFolderSP(templateVm.getDatacenter(),clusterFolder,folderList);
    storeProcedures[i]=sp;
    i++;
  }
  return executeFolderCreationProcedures(cluster,storeProcedures);
}
Program: 48334
Project: 48334
Buggy source:
public Map<String,Set<String>> getRackHostsMap(List<String> addedNodeNames){
  if (!AmUtils.isAmbariServerGreaterOrEquals_2_1_0(ambariServerVersion)) {
    return null;
  }
  Map<String,Set<String>> rackHostsMap=new HashMap<String,Set<String>>();
  List<AmNodeDef> nodes=getNodes();
  for (  AmNodeDef node : nodes) {
    if (addedNodeNames != null && !addedNodeNames.contains(node.getName())) {
      continue;
    }
    String rack=this.rackTopology.get(node.getIp());
    if (rack != null) {
      Set<String> hosts=rackHostsMap.get(rack);
      if (hosts == null) {
        hosts=new HashSet<String>();
      }
      hosts.add(node.getFqdn());
      rackHostsMap.put(rack,hosts);
    }
  }
  return rackHostsMap;
}

Fixed version (ground truth):
public Map<String,Set<String>> getRackHostsMap(List<String> addedNodeNames){
  if (this.rackTopology == null || !AmUtils.isAmbariServerGreaterOrEquals_2_1_0(ambariServerVersion)) {
    return null;
  }
  Map<String,Set<String>> rackHostsMap=new HashMap<String,Set<String>>();
  List<AmNodeDef> nodes=getNodes();
  for (  AmNodeDef node : nodes) {
    if (addedNodeNames != null && !addedNodeNames.contains(node.getName())) {
      continue;
    }
    String rack=this.rackTopology.get(node.getIp());
    if (rack != null) {
      Set<String> hosts=rackHostsMap.get(rack);
      if (hosts == null) {
        hosts=new HashSet<String>();
      }
      hosts.add(node.getFqdn());
      rackHostsMap.put(rack,hosts);
    }
  }
  return rackHostsMap;
}
Program: 48335
Project: 48335
Buggy source:
@Override public ApiBootstrap createBootstrap(ApiBootstrap bootstrap) throws AmbariApiException {
  logger.info("String_Node_Str");
  logger.info(ApiUtils.objectToJson(bootstrap));
  Response response=null;
  try {
    response=apiResourceRootV1.getBootstrapResource().createBootstrap(ApiUtils.objectToJson(bootstrap));
  }
 catch (  Exception e) {
    throw AmbariApiException.CANNOT_CONNECT_AMBARI_SERVER(e);
  }
  String bootstrapJson=handleAmbariResponse(response);
  logger.debug("String_Node_Str");
  logger.debug(bootstrapJson);
  ApiBootstrap apiBootstrap=ApiUtils.jsonToObject(ApiBootstrap.class,bootstrapJson);
  return apiBootstrap;
}

Fixed version (ground truth):
@Override public ApiBootstrap createBootstrap(ApiBootstrap bootstrap) throws AmbariApiException {
  logger.info("String_Node_Str");
  logger.info(ApiUtils.objectToJson(bootstrap.getHosts()));
  Response response=null;
  try {
    response=apiResourceRootV1.getBootstrapResource().createBootstrap(ApiUtils.objectToJson(bootstrap));
  }
 catch (  Exception e) {
    throw AmbariApiException.CANNOT_CONNECT_AMBARI_SERVER(e);
  }
  String bootstrapJson=handleAmbariResponse(response);
  logger.debug("String_Node_Str");
  logger.debug(bootstrapJson);
  ApiBootstrap apiBootstrap=ApiUtils.jsonToObject(ApiBootstrap.class,bootstrapJson);
  return apiBootstrap;
}
Program: 48336
Project: 48336
Buggy source:
private CreateVmSP getReplacementVmSp(ClusterCreate clusterSpec,String groupName,NodeEntity node,List<DiskSpec> fullDiskSet){
  VmSchema createSchema=VcVmUtil.getVmSchema(clusterSpec,groupName,fullDiskSet,node.getNodeGroup().getCluster().getTemplateId(),Constants.ROOT_SNAPSTHOT_NAME);
  Map<String,String> guestVariable=generateMachineId(clusterSpec,node);
  VcVmUtil.addBootupUUID(guestVariable);
  boolean ha=getHaFlag(clusterSpec,groupName);
  boolean ft=getFtFlag(clusterSpec,groupName);
  boolean isMapDistro=clusterEntityMgr.findByName(clusterSpec.getName()).getDistroVendor().equalsIgnoreCase(Constants.MAPR_VENDOR);
  ReplaceVmPrePowerOn prePowerOn=new ReplaceVmPrePowerOn(isMapDistro,node.getMoId(),node.getVmName(),clusterSpec.getNodeGroup(groupName).getStorage().getShares(),createSchema.networkSchema,createSchema.diskSchema,ha,ft);
  String newVmName=node.getVmName();
  if (node.getMoId() != null && !node.getMoId().isEmpty()) {
    newVmName=node.getVmName() + RECOVERY_VM_NAME_POSTFIX;
  }
  return new CreateVmSP(newVmName,createSchema,VcVmUtil.getTargetRp(clusterSpec.getName(),groupName,node),getTargetDatastore(fullDiskSet),prePowerOn,null,guestVariable,VcVmCloneType.FULL,true,getTargetFolder(node),getTargetHost(node));
}

Fixed version (ground truth):
private CreateVmSP getReplacementVmSp(ClusterCreate clusterSpec,String groupName,NodeEntity node,List<DiskSpec> fullDiskSet){
  VmSchema createSchema=VcVmUtil.getVmSchema(clusterSpec,groupName,fullDiskSet,node.getNodeGroup().getCluster().getTemplateId(),Constants.ROOT_SNAPSTHOT_NAME);
  Map<String,String> guestVariable=generateMachineId(clusterSpec,node);
  VcVmUtil.addBootupUUID(guestVariable);
  boolean ha=getHaFlag(clusterSpec,groupName);
  boolean ft=getFtFlag(clusterSpec,groupName);
  boolean isMapDistro=clusterEntityMgr.findByName(clusterSpec.getName()).getDistroVendor().equalsIgnoreCase(Constants.MAPR_VENDOR);
  ReplaceVmPrePowerOn prePowerOn=new ReplaceVmPrePowerOn(node.getMoId(),node.getVmName(),clusterSpec.getNodeGroup(groupName).getStorage().getShares(),createSchema.networkSchema,createSchema.diskSchema,ha,ft,isMapDistro);
  String newVmName=node.getVmName();
  if (node.getMoId() != null && !node.getMoId().isEmpty()) {
    newVmName=node.getVmName() + RECOVERY_VM_NAME_POSTFIX;
  }
  return new CreateVmSP(newVmName,createSchema,VcVmUtil.getTargetRp(clusterSpec.getName(),groupName,node),getTargetDatastore(fullDiskSet),prePowerOn,null,guestVariable,VcVmCloneType.FULL,true,getTargetFolder(node),getTargetHost(node));
}
Program: 48338
Project: 48338
Buggy source:
public ReplaceVmBadDisksSP(String vmId,DiskSchema diskSchema,VcResourcePool targetRp,VcDatastore targetDs,List<DiskEntity> badDataDiskEntities){
  this.vmId=vmId;
  this.diskSchema=diskSchema;
  this.targetRp=targetRp;
  this.targetDs=targetDs;
  this.badDataDiskEntities=badDataDiskEntities;
}

Fixed version (ground truth):
public ReplaceVmBadDisksSP(String vmId,DiskSchema diskSchema,VcResourcePool targetRp,VcDatastore targetDs,List<DiskEntity> badDataDiskEntities,boolean isMapDistro){
  this.isMapDistro=isMapDistro;
  this.vmId=vmId;
  this.diskSchema=diskSchema;
  this.targetRp=targetRp;
  this.targetDs=targetDs;
  this.badDataDiskEntities=badDataDiskEntities;
}
Program: 48339
Project: 48339
Buggy source:
private void replaceVmDataDisks(){
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      List<VcHost> hostList=new ArrayList<VcHost>();
      HashMap<String,Disk.Operation> diskMap=new HashMap<String,Disk.Operation>();
      List<DiskCreateSpec> addDisks=DiskSchemaUtil.getDisksToAdd(hostList,targetRp,targetDs,diskSchema,diskMap);
      DiskCreateSpec[] tmpAddDisks=addDisks.toArray(new DiskCreateSpec[addDisks.size()]);
      if (hostList.size() > 0 && !hostList.contains(vm.getHost())) {
        vm.migrate(hostList.get(0));
      }
      vm.changeDisks(null,tmpAddDisks);
      VcVmUtil.enableDiskUUID(vm);
      Map<String,String> bootupConfigs=vm.getGuestConfigs();
      AuAssert.check(bootupConfigs != null);
      VcVmUtil.addBootupUUID(bootupConfigs);
      bootupConfigs.put(Constants.GUEST_VARIABLE_RESERVE_RAW_DISKS,String.valueOf(false));
      bootupConfigs.put(Constants.GUEST_VARIABLE_VOLUMES,VcVmUtil.getVolumes(vm.getId(),diskSchema.getDisks()));
      vm.setGuestConfigs(bootupConfigs);
      logger.info("String_Node_Str" + bootupConfigs + "String_Node_Str"+ vm.getName());
      return null;
    }
    @Override protected boolean isTaskSession(){
      return true;
    }
  }
);
}

Fixed version (ground truth):
private void replaceVmDataDisks(){
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      List<VcHost> hostList=new ArrayList<VcHost>();
      HashMap<String,Disk.Operation> diskMap=new HashMap<String,Disk.Operation>();
      List<DiskCreateSpec> addDisks=DiskSchemaUtil.getDisksToAdd(hostList,targetRp,targetDs,diskSchema,diskMap);
      DiskCreateSpec[] tmpAddDisks=addDisks.toArray(new DiskCreateSpec[addDisks.size()]);
      if (hostList.size() > 0 && !hostList.contains(vm.getHost())) {
        vm.migrate(hostList.get(0));
      }
      vm.changeDisks(null,tmpAddDisks);
      VcVmUtil.enableDiskUUID(vm);
      Map<String,String> bootupConfigs=vm.getGuestConfigs();
      AuAssert.check(bootupConfigs != null);
      VcVmUtil.addBootupUUID(bootupConfigs);
      bootupConfigs.put(Constants.GUEST_VARIABLE_RESERVE_RAW_DISKS,String.valueOf(isMapDistro));
      bootupConfigs.put(Constants.GUEST_VARIABLE_VOLUMES,VcVmUtil.getVolumes(vm.getId(),diskSchema.getDisks()));
      vm.setGuestConfigs(bootupConfigs);
      logger.info("String_Node_Str" + bootupConfigs + "String_Node_Str"+ vm.getName());
      return null;
    }
    @Override protected boolean isTaskSession(){
      return true;
    }
  }
);
}
Program: 48340
Project: 48340
Buggy source:
@Override protected Void body() throws Exception {
  List<VcHost> hostList=new ArrayList<VcHost>();
  HashMap<String,Disk.Operation> diskMap=new HashMap<String,Disk.Operation>();
  List<DiskCreateSpec> addDisks=DiskSchemaUtil.getDisksToAdd(hostList,targetRp,targetDs,diskSchema,diskMap);
  DiskCreateSpec[] tmpAddDisks=addDisks.toArray(new DiskCreateSpec[addDisks.size()]);
  if (hostList.size() > 0 && !hostList.contains(vm.getHost())) {
    vm.migrate(hostList.get(0));
  }
  vm.changeDisks(null,tmpAddDisks);
  VcVmUtil.enableDiskUUID(vm);
  Map<String,String> bootupConfigs=vm.getGuestConfigs();
  AuAssert.check(bootupConfigs != null);
  VcVmUtil.addBootupUUID(bootupConfigs);
  bootupConfigs.put(Constants.GUEST_VARIABLE_RESERVE_RAW_DISKS,String.valueOf(false));
  bootupConfigs.put(Constants.GUEST_VARIABLE_VOLUMES,VcVmUtil.getVolumes(vm.getId(),diskSchema.getDisks()));
  vm.setGuestConfigs(bootupConfigs);
  logger.info("String_Node_Str" + bootupConfigs + "String_Node_Str"+ vm.getName());
  return null;
}

Fixed version (ground truth):
@Override protected Void body() throws Exception {
  List<VcHost> hostList=new ArrayList<VcHost>();
  HashMap<String,Disk.Operation> diskMap=new HashMap<String,Disk.Operation>();
  List<DiskCreateSpec> addDisks=DiskSchemaUtil.getDisksToAdd(hostList,targetRp,targetDs,diskSchema,diskMap);
  DiskCreateSpec[] tmpAddDisks=addDisks.toArray(new DiskCreateSpec[addDisks.size()]);
  if (hostList.size() > 0 && !hostList.contains(vm.getHost())) {
    vm.migrate(hostList.get(0));
  }
  vm.changeDisks(null,tmpAddDisks);
  VcVmUtil.enableDiskUUID(vm);
  Map<String,String> bootupConfigs=vm.getGuestConfigs();
  AuAssert.check(bootupConfigs != null);
  VcVmUtil.addBootupUUID(bootupConfigs);
  bootupConfigs.put(Constants.GUEST_VARIABLE_RESERVE_RAW_DISKS,String.valueOf(isMapDistro));
  bootupConfigs.put(Constants.GUEST_VARIABLE_VOLUMES,VcVmUtil.getVolumes(vm.getId(),diskSchema.getDisks()));
  vm.setGuestConfigs(bootupConfigs);
  logger.info("String_Node_Str" + bootupConfigs + "String_Node_Str"+ vm.getName());
  return null;
}
Program: 48341
Project: 48341
Buggy source:
public ReplaceVmPrePowerOn(boolean isMapDistro,String vmId,String newName,Priority ioShares,NetworkSchema networkSchema,DiskSchema diskSchema,boolean ha,boolean ft){
  this.oldVmId=vmId;
  this.newName=newName;
  this.ioShares=ioShares;
  this.networkSchema=networkSchema;
  this.diskSchema=diskSchema;
  this.ha=ha;
  this.ft=ft;
  this.isMapDistro=isMapDistro;
}

Fixed version (ground truth):
public ReplaceVmPrePowerOn(String vmId,String newName,Priority ioShares,NetworkSchema networkSchema,DiskSchema diskSchema,boolean ha,boolean ft,boolean isMapDistro){
  this.oldVmId=vmId;
  this.newName=newName;
  this.ioShares=ioShares;
  this.networkSchema=networkSchema;
  this.diskSchema=diskSchema;
  this.ha=ha;
  this.ft=ft;
  this.isMapDistro=isMapDistro;
}
Program: 48343
Project: 48343
Buggy source:
@Override protected List<NodeEntity> getNodesToBeSetLocalRepo(ChunkContext chunkContext,String clusterName) throws TaskException {
  List<NodeEntity> toBeSetLocalRepo=null;
  List<NodeEntity> nodesInGroup=null;
  List<String> nodeGroupNames=new ArrayList<String>();
  String nodeGroupNameList=TrackableTasklet.getJobParameters(chunkContext).getString(JobConstants.NEW_NODE_GROUP_LIST_JOB_PARAM);
  logger.info("String_Node_Str");
  for (  String nodeGroupName : nodeGroupNameList.split("String_Node_Str")) {
    nodeGroupNames.add(nodeGroupName);
  }
  for (  String nodeGroupName : nodeGroupNames) {
    nodesInGroup=clusterEntityMgr.findAllNodes(clusterName,nodeGroupName);
  }
  for (  NodeEntity node : nodesInGroup) {
    if (node.getStatus().ordinal() >= NodeStatus.VM_READY.ordinal()) {
      if (toBeSetLocalRepo == null) {
        toBeSetLocalRepo=new ArrayList<NodeEntity>();
      }
      toBeSetLocalRepo.add(node);
    }
  }
  return toBeSetLocalRepo;
}

Fixed version (ground truth):
@Override protected List<NodeEntity> getNodesToBeSetLocalRepo(ChunkContext chunkContext,String clusterName) throws TaskException {
  List<NodeEntity> toBeSetLocalRepo=null;
  List<NodeEntity> nodesInGroup=null;
  List<NodeEntity> addNodes=new ArrayList<NodeEntity>();
  List<String> nodeGroupNames=null;
  String nodeGroupNameList=TrackableTasklet.getJobParameters(chunkContext).getString(JobConstants.NEW_NODE_GROUP_LIST_JOB_PARAM);
  nodeGroupNames=ClusterUtil.getNodesFromNodeGroups(nodeGroupNameList);
  for (  String nodeGroupName : nodeGroupNames) {
    nodesInGroup=clusterEntityMgr.findAllNodes(clusterName,nodeGroupName);
    for (    NodeEntity ne : nodesInGroup) {
      addNodes.add(ne);
    }
  }
  toBeSetLocalRepo=ClusterUtil.getReadyVmFromNodeGroups(addNodes);
  return toBeSetLocalRepo;
}
Program: 48344
Project: 48344
Buggy source:
protected List<NodeEntity> findNodesToEnableLdap(ChunkContext chunkContext) throws TaskException {
  List<NodeEntity> foundNodeList=null;
  List<NodeEntity> nodesInGroup=null;
  List<String> nodeGroupNames=new ArrayList<String>();
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  String nodeGroupNameList=TrackableTasklet.getJobParameters(chunkContext).getString(JobConstants.NEW_NODE_GROUP_LIST_JOB_PARAM);
  for (  String nodeGroupName : nodeGroupNameList.split("String_Node_Str")) {
    nodeGroupNames.add(nodeGroupName);
  }
  for (  String nodeGroupName : nodeGroupNames) {
    nodesInGroup=clusterEntityMgr.findAllNodes(clusterName,nodeGroupName);
  }
  for (  NodeEntity node : nodesInGroup) {
    if (node.getStatus().ordinal() >= NodeStatus.VM_READY.ordinal()) {
      if (foundNodeList == null) {
        foundNodeList=new ArrayList<NodeEntity>();
      }
      foundNodeList.add(node);
    }
  }
  return foundNodeList;
}

Fixed version (ground truth):
protected List<NodeEntity> findNodesToEnableLdap(ChunkContext chunkContext) throws TaskException {
  List<NodeEntity> foundNodeList=null;
  List<NodeEntity> nodesInGroup=null;
  List<NodeEntity> addNodes=new ArrayList<NodeEntity>();
  List<String> nodeGroupNames=null;
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  String nodeGroupNameList=TrackableTasklet.getJobParameters(chunkContext).getString(JobConstants.NEW_NODE_GROUP_LIST_JOB_PARAM);
  nodeGroupNames=ClusterUtil.getNodesFromNodeGroups(nodeGroupNameList);
  for (  String nodeGroupName : nodeGroupNames) {
    nodesInGroup=clusterEntityMgr.findAllNodes(clusterName,nodeGroupName);
    for (    NodeEntity ne : nodesInGroup) {
      addNodes.add(ne);
    }
  }
  foundNodeList=ClusterUtil.getReadyVmFromNodeGroups(addNodes);
  return foundNodeList;
}
Program: 48345
Project: 48345
Buggy source:
@Override protected List<NodeEntity> getNodesToBeSetPassword(ChunkContext chunkContext) throws TaskException {
  List<NodeEntity> toBeSetPassword=null;
  List<NodeEntity> nodesInGroup=null;
  List<String> nodeGroupNames=new ArrayList<String>();
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  String nodeGroupNameList=TrackableTasklet.getJobParameters(chunkContext).getString(JobConstants.NEW_NODE_GROUP_LIST_JOB_PARAM);
  for (  String nodeGroupName : nodeGroupNameList.split("String_Node_Str")) {
    nodeGroupNames.add(nodeGroupName);
  }
  for (  String nodeGroupName : nodeGroupNames) {
    nodesInGroup=clusterEntityMgr.findAllNodes(clusterName,nodeGroupName);
  }
  for (  NodeEntity node : nodesInGroup) {
    if (node.getStatus().ordinal() >= NodeStatus.VM_READY.ordinal()) {
      if (toBeSetPassword == null) {
        toBeSetPassword=new ArrayList<NodeEntity>();
      }
      toBeSetPassword.add(node);
    }
  }
  return toBeSetPassword;
}

Fixed version (ground truth):
@Override protected List<NodeEntity> getNodesToBeSetPassword(ChunkContext chunkContext) throws TaskException {
  List<NodeEntity> toBeSetPassword=null;
  List<NodeEntity> nodesInGroup=null;
  List<NodeEntity> addNodes=new ArrayList<NodeEntity>();
  List<String> nodeGroupNames=null;
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  String nodeGroupNameList=TrackableTasklet.getJobParameters(chunkContext).getString(JobConstants.NEW_NODE_GROUP_LIST_JOB_PARAM);
  nodeGroupNames=ClusterUtil.getNodesFromNodeGroups(nodeGroupNameList);
  for (  String nodeGroupName : nodeGroupNames) {
    nodesInGroup=clusterEntityMgr.findAllNodes(clusterName,nodeGroupName);
    for (    NodeEntity ne : nodesInGroup) {
      addNodes.add(ne);
    }
  }
  toBeSetPassword=ClusterUtil.getReadyVmFromNodeGroups(addNodes);
  return toBeSetPassword;
}
Program: 48347
Project: 48347
Buggy source:
private List<String> getNewNodeGroupVmNames(ChunkContext chunkContext,ClusterBlueprint clusterBlueprint){
  List<String> nodeGroupNames=new ArrayList<String>();
  String nodeGroupNameList=TrackableTasklet.getJobParameters(chunkContext).getString(JobConstants.NEW_NODE_GROUP_LIST_JOB_PARAM);
  for (  String nodeGroupName : nodeGroupNameList.split("String_Node_Str")) {
    nodeGroupNames.add(nodeGroupName);
  }
  List<String> addedNodeNames=new ArrayList<String>();
  for (  String groupName : nodeGroupNames) {
    for (    NodeGroupInfo group : clusterBlueprint.getNodeGroups()) {
      if (group.getName().equals(groupName)) {
        for (        NodeInfo node : group.getNodes()) {
          if (JobUtils.getJobParameterForceClusterOperation(chunkContext)) {
            NodeStatus status=lockedClusterEntityManager.getClusterEntityMgr().findNodeByName(node.getName()).getStatus();
            logger.info(String.format("String_Node_Str",node.getName(),status.name()));
            if ((status != NodeStatus.VM_READY) && (status != NodeStatus.BOOTSTRAP_FAILED)) {
              continue;
            }
          }
          addedNodeNames.add(node.getName());
        }
      }
    }
  }
  return addedNodeNames;
}

Fixed version (ground truth):
private List<String> getNewNodeGroupVmNames(ChunkContext chunkContext,ClusterBlueprint clusterBlueprint){
  List<String> nodeGroupNames=new ArrayList<String>();
  String nodeGroupNameList=TrackableTasklet.getJobParameters(chunkContext).getString(JobConstants.NEW_NODE_GROUP_LIST_JOB_PARAM);
  for (  String nodeGroupName : nodeGroupNameList.split("String_Node_Str")) {
    nodeGroupNames.add(nodeGroupName);
  }
  logger.info("String_Node_Str" + nodeGroupNameList);
  for (  String nodeName : nodeGroupNames) {
    logger.info("String_Node_Str" + nodeName);
  }
  List<String> addedNodeNames=new ArrayList<String>();
  for (  String groupName : nodeGroupNames) {
    for (    NodeGroupInfo group : clusterBlueprint.getNodeGroups()) {
      if (group.getName().equals(groupName)) {
        for (        NodeInfo node : group.getNodes()) {
          if (JobUtils.getJobParameterForceClusterOperation(chunkContext)) {
            NodeStatus status=lockedClusterEntityManager.getClusterEntityMgr().findNodeByName(node.getName()).getStatus();
            logger.info(String.format("String_Node_Str",node.getName(),status.name()));
            if ((status != NodeStatus.VM_READY) && (status != NodeStatus.BOOTSTRAP_FAILED)) {
              continue;
            }
          }
          addedNodeNames.add(node.getName());
        }
      }
    }
  }
  for (  String nodeName : addedNodeNames) {
    logger.info("String_Node_Str" + nodeName);
  }
  return addedNodeNames;
}
Program: 48352
Project: 48352
Buggy source:
private void validateMemorySize(List<NodeGroupEntity> nodeGroups,List<String> failedMsgList){
  boolean validated=true;
  StringBuilder invalidNodeGroupNames=new StringBuilder();
  for (  NodeGroupEntity nodeGroup : nodeGroups) {
    if (nodeGroup.getMemorySize() < Constants.MIN_MEM_SIZE) {
      validated=false;
      invalidNodeGroupNames.append(nodeGroup.getName()).append("String_Node_Str");
    }
  }
  if (!validated) {
    StringBuilder errorMsgBuff=new StringBuilder();
    invalidNodeGroupNames.delete(invalidNodeGroupNames.length() - 1,invalidNodeGroupNames.length());
    failedMsgList.add(errorMsgBuff.append("String_Node_Str" + Constants.MIN_MEM_SIZE + "String_Node_Str").append(invalidNodeGroupNames.toString()).append("String_Node_Str").toString());
  }
}

Fixed version (ground truth):
private void validateMemorySize(Set<NodeGroupEntity> nodeGroups,List<String> failedMsgList){
  boolean validated=true;
  StringBuilder invalidNodeGroupNames=new StringBuilder();
  for (  NodeGroupEntity nodeGroup : nodeGroups) {
    if (nodeGroup.getMemorySize() < Constants.MIN_MEM_SIZE) {
      validated=false;
      invalidNodeGroupNames.append(nodeGroup.getName()).append("String_Node_Str");
    }
  }
  if (!validated) {
    StringBuilder errorMsgBuff=new StringBuilder();
    invalidNodeGroupNames.delete(invalidNodeGroupNames.length() - 1,invalidNodeGroupNames.length());
    failedMsgList.add(errorMsgBuff.append("String_Node_Str" + Constants.MIN_MEM_SIZE + "String_Node_Str").append(invalidNodeGroupNames.toString()).append("String_Node_Str").toString());
  }
}
Program: 48355
Project: 48355
Buggy source:
private List<NodeGroupEntity> convertNodeGroupsToEntities(Gson gson,ClusterEntity clusterEntity,String distro,NodeGroupCreate[] groups,boolean validateWhiteList){
  List<NodeGroupEntity> nodeGroups=new LinkedList<NodeGroupEntity>();
  for (  NodeGroupCreate group : groups) {
    NodeGroupEntity groupEntity=convertGroup(gson,clusterEntity,group,distro,validateWhiteList);
    if (groupEntity != null) {
      nodeGroups.add(groupEntity);
    }
  }
  return nodeGroups;
}

Fixed version (ground truth):
private Set<NodeGroupEntity> convertNodeGroupsToEntities(Gson gson,ClusterEntity clusterEntity,String distro,NodeGroupCreate[] groups,boolean validateWhiteList){
  Set<NodeGroupEntity> nodeGroups=new HashSet<NodeGroupEntity>();
  for (  NodeGroupCreate group : groups) {
    NodeGroupEntity groupEntity=convertGroup(gson,clusterEntity,group,distro,validateWhiteList);
    if (groupEntity != null) {
      nodeGroups.add(groupEntity);
    }
  }
  return nodeGroups;
}
Program: 48356
Project: 48356
Buggy source:
private void updateNodegroupAppConfig(ClusterCreate clusterCreate,ClusterEntity cluster,boolean validateWhiteList){
  Gson gson=new Gson();
  List<NodeGroupEntity> groupEntities=cluster.getNodeGroups();
  Map<String,NodeGroupEntity> groupMap=new HashMap<String,NodeGroupEntity>();
  for (  NodeGroupEntity entity : groupEntities) {
    groupMap.put(entity.getName(),entity);
  }
  Set<String> updatedGroups=new HashSet<String>();
  NodeGroupCreate[] groupCreates=clusterCreate.getNodeGroups();
  if (groupCreates == null) {
    return;
  }
  for (  NodeGroupCreate groupCreate : groupCreates) {
    Map<String,Object> groupConfig=groupCreate.getConfiguration();
    if (groupConfig != null && groupConfig.size() > 0) {
      NodeGroupEntity groupEntity=groupMap.get(groupCreate.getName());
      groupEntity.setHadoopConfig(gson.toJson(groupConfig));
      updatedGroups.add(groupCreate.getName());
    }
  }
  for (  NodeGroupEntity entity : groupEntities) {
    if (updatedGroups.contains(entity.getName())) {
      continue;
    }
    entity.setHadoopConfig(null);
  }
}

Fixed version (ground truth):
private void updateNodegroupAppConfig(ClusterCreate clusterCreate,ClusterEntity cluster,boolean validateWhiteList){
  Gson gson=new Gson();
  Set<NodeGroupEntity> groupEntities=cluster.getNodeGroups();
  Map<String,NodeGroupEntity> groupMap=new HashMap<String,NodeGroupEntity>();
  for (  NodeGroupEntity entity : groupEntities) {
    groupMap.put(entity.getName(),entity);
  }
  Set<String> updatedGroups=new HashSet<String>();
  NodeGroupCreate[] groupCreates=clusterCreate.getNodeGroups();
  if (groupCreates == null) {
    return;
  }
  for (  NodeGroupCreate groupCreate : groupCreates) {
    Map<String,Object> groupConfig=groupCreate.getConfiguration();
    if (groupConfig != null && groupConfig.size() > 0) {
      NodeGroupEntity groupEntity=groupMap.get(groupCreate.getName());
      groupEntity.setHadoopConfig(gson.toJson(groupConfig));
      updatedGroups.add(groupCreate.getName());
    }
  }
  for (  NodeGroupEntity entity : groupEntities) {
    if (updatedGroups.contains(entity.getName())) {
      continue;
    }
    entity.setHadoopConfig(null);
  }
}
Program: 48358
Project: 48358
Buggy source:
public Map<String,String> getRackTopology(String clusterName,String topology){
  ClusterRead cluster=clusterEntityMgr.toClusterRead(clusterName,true);
  Set<String> hosts=new HashSet<String>();
  List<NodeRead> nodes=new ArrayList<NodeRead>();
  for (  NodeGroupRead nodeGroup : cluster.getNodeGroups()) {
    for (    NodeRead node : nodeGroup.getInstances()) {
      if (node.getMoId() != null) {
        hosts.add(node.getHostName());
        nodes.add(node);
      }
    }
  }
  if (CommonUtil.isBlank(topology)) {
    topology=cluster.getTopologyPolicy().toString();
  }
  AuAssert.check(hosts.size() > 0);
  clusterConfigMgr.validateRackTopologyUploaded(hosts,topology);
  return clusterConfigMgr.buildTopology(nodes,topology);
}

Fixed version (ground truth):
public Map<String,String> getRackTopology(String clusterName,String topology){
  ClusterRead cluster=clusterEntityMgr.findClusterWithNodes(clusterName,false);
  Set<String> hosts=new HashSet<String>();
  List<NodeRead> nodes=new ArrayList<NodeRead>();
  for (  NodeGroupRead nodeGroup : cluster.getNodeGroups()) {
    for (    NodeRead node : nodeGroup.getInstances()) {
      if (node.getMoId() != null) {
        hosts.add(node.getHostName());
        nodes.add(node);
      }
    }
  }
  if (CommonUtil.isBlank(topology)) {
    topology=cluster.getTopologyPolicy().toString();
  }
  AuAssert.check(hosts.size() > 0);
  clusterConfigMgr.validateRackTopologyUploaded(hosts,topology);
  return clusterConfigMgr.buildTopology(nodes,topology);
}
Program: 48359
Project: 48359
Buggy source:
public Map<String,Object> getClusterConfigManifest(String clusterName,List<String> targets,boolean needAllocIp){
  ClusterCreate clusterConfig=clusterConfigMgr.getClusterConfig(clusterName,needAllocIp);
  Map<String,String> cloudProvider=resMgr.getCloudProviderAttributes();
  ClusterRead read=clusterEntityMgr.toClusterRead(clusterName,true);
  Map<String,Object> attrs=new HashMap<String,Object>();
  if (Constants.IRONFAN.equalsIgnoreCase(clusterConfig.getAppManager())) {
    SoftwareManager softwareManager=clusterConfigMgr.getSoftwareManager(clusterConfig.getAppManager());
    IronfanStack stack=(IronfanStack)filterDistroFromAppManager(softwareManager,clusterConfig.getDistro());
    CommonClusterExpandPolicy.expandDistro(clusterConfig,stack);
    attrs.put("String_Node_Str",cloudProvider);
    attrs.put("String_Node_Str",clusterConfig);
  }
  if (read != null) {
    attrs.put("String_Node_Str",read);
  }
  if (targets != null && !targets.isEmpty()) {
    attrs.put("String_Node_Str",targets);
  }
  return attrs;
}

Fixed version (ground truth):
public Map<String,Object> getClusterConfigManifest(String clusterName,List<String> targets,boolean needAllocIp){
  ClusterCreate clusterConfig=clusterConfigMgr.getClusterConfig(clusterName,needAllocIp);
  Map<String,String> cloudProvider=resMgr.getCloudProviderAttributes();
  ClusterRead read=clusterEntityMgr.findClusterWithNodes(clusterName,true);
  Map<String,Object> attrs=new HashMap<String,Object>();
  if (Constants.IRONFAN.equalsIgnoreCase(clusterConfig.getAppManager())) {
    SoftwareManager softwareManager=clusterConfigMgr.getSoftwareManager(clusterConfig.getAppManager());
    IronfanStack stack=(IronfanStack)filterDistroFromAppManager(softwareManager,clusterConfig.getDistro());
    CommonClusterExpandPolicy.expandDistro(clusterConfig,stack);
    attrs.put("String_Node_Str",cloudProvider);
    attrs.put("String_Node_Str",clusterConfig);
  }
  if (read != null) {
    attrs.put("String_Node_Str",read);
  }
  if (targets != null && !targets.isEmpty()) {
    attrs.put("String_Node_Str",targets);
  }
  return attrs;
}
Program: 48360
Project: 48360
Buggy source:
public ClusterRead getClusterByName(String clusterName,boolean realTime){
  ClusterEntity cluster=clusterEntityMgr.findByName(clusterName);
  if (cluster == null) {
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  java.util.Date startTime=new java.util.Date();
  if (realTime && cluster.getStatus().isSyncServiceStatus()) {
    refreshClusterStatus(clusterName);
  }
  logger.debug("String_Node_Str" + (new java.util.Date().getTime() - startTime.getTime()));
  return clusterEntityMgr.toClusterRead(clusterName,realTime);
}

Fixed version (ground truth):
public ClusterRead getClusterByName(String clusterName,boolean realTime){
  ClusterEntity cluster=clusterEntityMgr.findByName(clusterName);
  if (cluster == null) {
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  java.util.Date startTime=new java.util.Date();
  if (realTime && cluster.getStatus().isSyncServiceStatus()) {
    refreshClusterStatus(clusterName);
  }
  logger.debug("String_Node_Str" + (new java.util.Date().getTime() - startTime.getTime()));
  return realTime ? clusterEntityMgr.findClusterWithNodes(clusterName,false) : clusterEntityMgr.findClusterWithNodeGroups(clusterName);
}
Program: 48361
Project: 48361
Buggy source:
public List<ClusterRead> getClusters(Boolean realTime){
  java.util.Date startTime=new java.util.Date();
  List<ClusterRead> clusters=new ArrayList<ClusterRead>();
  List<ClusterEntity> clusterEntities=clusterEntityMgr.findAllClusters();
  logger.debug("String_Node_Str" + (new java.util.Date().getTime() - startTime.getTime()));
  for (  ClusterEntity entity : clusterEntities) {
    clusters.add(getClusterByName(entity.getName(),realTime));
  }
  logger.debug("String_Node_Str" + (new java.util.Date().getTime() - startTime.getTime()));
  return clusters;
}

Fixed version (ground truth):
public List<ClusterRead> getClusters(Boolean realTime){
  java.util.Date startTime=new java.util.Date();
  List<ClusterRead> clusters=new ArrayList<ClusterRead>();
  List<String> clusterNames=clusterEntityMgr.findAllClusterNames();
  logger.debug("String_Node_Str" + (new java.util.Date().getTime() - startTime.getTime()));
  for (  String clusterName : clusterNames) {
    clusters.add(getClusterByName(clusterName,realTime));
  }
  logger.debug("String_Node_Str" + (new java.util.Date().getTime() - startTime.getTime()));
  return clusters;
}
Program: 48362
Project: 48362
Buggy source:
public static void setOwnerOnlyReadWrite(String filename) throws IOException {
  Set<PosixFilePermission> perms=new HashSet<PosixFilePermission>();
  perms.add(PosixFilePermission.OWNER_READ);
  perms.add(PosixFilePermission.OWNER_WRITE);
  Files.setPosixFilePermissions(Paths.get(filename),perms);
}

Fixed version (ground truth):
public static void setOwnerOnlyReadWrite(String filename) throws IOException {
  if (new File(filename).exists()) {
    Set<PosixFilePermission> perms=new HashSet<PosixFilePermission>();
    perms.add(PosixFilePermission.OWNER_READ);
    perms.add(PosixFilePermission.OWNER_WRITE);
    Files.setPosixFilePermissions(Paths.get(filename),perms);
  }
 else {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + filename);
    }
  }
}
Program: 48364
Project: 48364
Buggy source:
private boolean isTheSameConfigGroup(ApiConfigGroupInfo apiConfigGroupInfo,AmHostGroupInfo amHostGroupInfo){
  List<String> associatedHosts=new ArrayList<String>();
  for (  ApiHostInfo apiHostInfo : apiConfigGroupInfo.getHosts()) {
    associatedHosts.add(apiHostInfo.getHostName());
  }
  boolean isTheSameConfigGroup=true;
  for (  String host : associatedHosts) {
    if (!amHostGroupInfo.getHosts().contains(host)) {
      isTheSameConfigGroup=false;
      break;
    }
  }
  return isTheSameConfigGroup;
}

Fixed version (ground truth):
private boolean isTheSameConfigGroup(ApiConfigGroupInfo apiConfigGroupInfo,AmHostGroupInfo amHostGroupInfo){
  List<String> associatedHosts=new ArrayList<String>();
  for (  ApiHostInfo apiHostInfo : apiConfigGroupInfo.getHosts()) {
    associatedHosts.add(apiHostInfo.getHostName());
  }
  logger.info("String_Node_Str" + ApiUtils.objectToJson(associatedHosts));
  if (CollectionUtils.isEmpty(associatedHosts)) {
    return false;
  }
  boolean isTheSameConfigGroup=true;
  for (  String host : associatedHosts) {
    if (!amHostGroupInfo.getHosts().contains(host)) {
      logger.info("String_Node_Str" + host + "String_Node_Str");
      isTheSameConfigGroup=false;
      break;
    }
  }
  return isTheSameConfigGroup;
}
Program: 48366
Project: 48366
Buggy source:
public AmHostGroupInfo(AmNodeDef node,AmNodeGroupDef nodeGroup,Map<String,String> configTypeToService){
  this.ambariServerVersion=nodeGroup.getAmbariServerVersion();
  String configGroupName=nodeGroup.getName() + "String_Node_Str" + node.getVolumesCount();
  if (!AmUtils.isAmbariServerBelow_2_0_0(this.ambariServerVersion)) {
    configGroupName=nodeGroup.getClusterName() + "String_Node_Str" + nodeGroup.getName()+ "String_Node_Str"+ node.getVolumesCount();
  }
  this.configGroupName=configGroupName;
  this.nodeGroupName=nodeGroup.getName();
  this.cardinality=1;
  this.roles=nodeGroup.getRoles();
  this.volumesCount=node.getVolumesCount();
  List<Map<String,Object>> configurations=new ArrayList<Map<String,Object>>();
  if (!nodeGroup.getConfigurations().isEmpty()) {
    configurations.addAll(nodeGroup.getConfigurations());
  }
  if (!node.getConfigurations().isEmpty()) {
    configurations.addAll(node.getConfigurations());
  }
  this.configurations=configurations;
  Set<String> hosts=new HashSet<String>();
  hosts.add(node.getFqdn());
  this.hosts=hosts;
  if (configTypeToService != null) {
    for (    String service : getServices(configTypeToService,configurations)) {
      this.tag2Hosts.put(service,hosts);
    }
  }
}

Fixed version (ground truth):
public AmHostGroupInfo(AmNodeDef node,AmNodeGroupDef nodeGroup,Map<String,String> configTypeToService){
  this.ambariServerVersion=nodeGroup.getAmbariServerVersion();
  this.configTypeToService=configTypeToService;
  String configGroupName=nodeGroup.getName() + "String_Node_Str" + node.getVolumesCount();
  if (!AmUtils.isAmbariServerBelow_2_0_0(this.ambariServerVersion) && this.configTypeToService != null) {
    configGroupName=nodeGroup.getClusterName() + "String_Node_Str" + nodeGroup.getName()+ "String_Node_Str"+ node.getVolumesCount();
  }
  this.configGroupName=configGroupName;
  this.nodeGroupName=nodeGroup.getName();
  this.cardinality=1;
  this.roles=nodeGroup.getRoles();
  this.volumesCount=node.getVolumesCount();
  List<Map<String,Object>> configurations=new ArrayList<Map<String,Object>>();
  if (!nodeGroup.getConfigurations().isEmpty()) {
    configurations.addAll(nodeGroup.getConfigurations());
  }
  if (!node.getConfigurations().isEmpty()) {
    configurations.addAll(node.getConfigurations());
  }
  this.configurations=configurations;
  Set<String> hosts=new HashSet<String>();
  hosts.add(node.getFqdn());
  this.hosts=hosts;
  if (this.configTypeToService != null) {
    for (    String service : getServices(configTypeToService,configurations)) {
      this.tag2Hosts.put(service,hosts);
    }
  }
}
Program: 48367
Project: 48367
Buggy source:
public void updateConfigGroupName(AmNodeGroupDef nodeGroup){
  String configGroupName=nodeGroup.getName();
  if (!AmUtils.isAmbariServerBelow_2_0_0(this.ambariServerVersion)) {
    configGroupName=nodeGroup.getClusterName() + "String_Node_Str" + nodeGroup.getName();
  }
  this.configGroupName=configGroupName;
}

Fixed version (ground truth):
public void updateConfigGroupName(AmNodeGroupDef nodeGroup){
  String configGroupName=nodeGroup.getName();
  if (!AmUtils.isAmbariServerBelow_2_0_0(this.ambariServerVersion) && this.configTypeToService != null) {
    configGroupName=nodeGroup.getClusterName() + "String_Node_Str" + nodeGroup.getName();
  }
  this.configGroupName=configGroupName;
}
Program: 48370
Project: 48370
Buggy source:
/** 
 * Validate nodeGroupCreates member formats and values in the ClusterCreate.
 */
public void validateClusterCreate(List<String> failedMsgList,List<String> warningMsgList){
  NodeGroupCreate[] nodeGroupCreates=getNodeGroups();
  AuAssert.check(nodeGroupCreates != null && nodeGroupCreates.length > 0);
  if (hasHDFSUrlConfigured() && !validateHDFSUrl()) {
    failedMsgList.add(new StringBuilder().append("String_Node_Str").append(getExternalHDFS()).toString());
  }
  validateNodeGroupPlacementPolicies(failedMsgList,warningMsgList);
  validateStorageType(failedMsgList);
  validateSwapRatio(nodeGroupCreates,failedMsgList);
  for (  NodeGroupCreate nodeGroupCreate : nodeGroupCreates) {
    checkInstanceNum(nodeGroupCreate,failedMsgList);
    checkCPUAndMemory(nodeGroupCreate,failedMsgList,warningMsgList);
  }
  if (!warningMsgList.isEmpty() && !warningMsgList.get(0).startsWith("String_Node_Str")) {
    warningMsgList.set(0,"String_Node_Str" + warningMsgList.get(0));
  }
}

Fixed version (ground truth):
/** 
 * Validate nodeGroupCreates member formats and values in the ClusterCreate.
 */
public void validateClusterCreate(List<String> failedMsgList,List<String> warningMsgList){
  NodeGroupCreate[] nodeGroupCreates=getNodeGroups();
  AuAssert.check(nodeGroupCreates != null && nodeGroupCreates.length > 0);
  if (hasHDFSUrlConfigured() && !validateHDFSUrl()) {
    failedMsgList.add(new StringBuilder().append("String_Node_Str").append(getExternalHDFS()).toString());
  }
  validateNodeGroupPlacementPolicies(failedMsgList,warningMsgList);
  validateStorageType(failedMsgList);
  validateSwapRatio(nodeGroupCreates,failedMsgList);
  validateCpuRatio(nodeGroupCreates,failedMsgList);
  validateMemRatio(nodeGroupCreates,failedMsgList);
  for (  NodeGroupCreate nodeGroupCreate : nodeGroupCreates) {
    checkInstanceNum(nodeGroupCreate,failedMsgList);
    checkCPUAndMemory(nodeGroupCreate,failedMsgList,warningMsgList);
  }
  if (!warningMsgList.isEmpty() && !warningMsgList.get(0).startsWith("String_Node_Str")) {
    warningMsgList.set(0,"String_Node_Str" + warningMsgList.get(0));
  }
}
Program: 48371
Project: 48371
Buggy source:
public NodeGroupInfo toNodeGroupInfo(){
  NodeGroupInfo nodeGroupInfo=new NodeGroupInfo();
  nodeGroupInfo.setName(name);
  nodeGroupInfo.setInstanceNum(instanceNum);
  nodeGroupInfo.setRoles(roles);
  nodeGroupInfo.setConfiguration(configuration);
  if (haFlag != null && (haFlag.equalsIgnoreCase(Constants.HA_FLAG_FT) || haFlag.equalsIgnoreCase(Constants.HA_FLAG_ON))) {
    nodeGroupInfo.setHaEnabled(true);
  }
  nodeGroupInfo.setInstanceType(instanceType);
  nodeGroupInfo.setPlacement(placementPolicies);
  if (storage != null) {
    nodeGroupInfo.setStorageSize(storage.getSizeGB());
    nodeGroupInfo.setStorageType(storage.getType());
  }
  nodeGroupInfo.setNodes(null);
  return nodeGroupInfo;
}

Fixed version (ground truth):
public NodeGroupInfo toNodeGroupInfo(){
  NodeGroupInfo nodeGroupInfo=new NodeGroupInfo();
  nodeGroupInfo.setName(name);
  nodeGroupInfo.setInstanceNum(instanceNum);
  nodeGroupInfo.setRoles(roles);
  nodeGroupInfo.setConfiguration(configuration);
  if (haFlag != null && (haFlag.equalsIgnoreCase(Constants.HA_FLAG_FT) || haFlag.equalsIgnoreCase(Constants.HA_FLAG_ON))) {
    nodeGroupInfo.setHaEnabled(true);
  }
  nodeGroupInfo.setInstanceType(instanceType);
  nodeGroupInfo.setPlacement(placementPolicies);
  if (storage != null) {
    nodeGroupInfo.setStorageSize(storage.getSizeGB());
    nodeGroupInfo.setStorageType(storage.getType());
  }
  if (latencySensitivity != null && !CommonUtil.isBlank(latencySensitivity.name())) {
    nodeGroupInfo.setLatencySensitivity(latencySensitivity);
  }
 else {
    nodeGroupInfo.setLatencySensitivity(LatencyPriority.NORMAL);
  }
  nodeGroupInfo.setReservedCpu_ratio(reservedCpu_ratio);
  nodeGroupInfo.setReservedMem_ratio(reservedMem_ratio);
  nodeGroupInfo.setNodes(null);
  return nodeGroupInfo;
}
Program: 48372
Project: 48372
Buggy source:
public NodeGroupCreate(NodeGroupCreate group){
  this.cpuNum=group.cpuNum;
  this.haFlag=group.haFlag;
  this.instanceNum=group.instanceNum;
  this.instanceType=group.instanceType;
  this.placementPolicies=group.placementPolicies;
  this.memCapacityMB=group.memCapacityMB;
  this.swapRatio=group.swapRatio;
  this.name=group.name;
  this.roles=group.roles;
  this.rpNames=group.rpNames;
  this.storage=group.storage;
  this.vcClusters=group.vcClusters;
  this.configuration=group.configuration;
  this.vmFolderPath=group.vmFolderPath;
}

Fixed version (ground truth):
public NodeGroupCreate(NodeGroupCreate group){
  this.cpuNum=group.cpuNum;
  this.haFlag=group.haFlag;
  this.instanceNum=group.instanceNum;
  this.instanceType=group.instanceType;
  this.placementPolicies=group.placementPolicies;
  this.memCapacityMB=group.memCapacityMB;
  this.swapRatio=group.swapRatio;
  this.latencySensitivity=group.latencySensitivity;
  this.reservedCpu_ratio=group.reservedCpu_ratio;
  this.reservedMem_ratio=group.reservedMem_ratio;
  this.name=group.name;
  this.roles=group.roles;
  this.rpNames=group.rpNames;
  this.storage=group.storage;
  this.vcClusters=group.vcClusters;
  this.configuration=group.configuration;
  this.vmFolderPath=group.vmFolderPath;
}