nus-yam/ex-repair huggingface dataset:
Program: 48974
Project: 48974
Buggy source:
private void convertTemplateVm(){
  templateNode=new BaseNode(templateVm.getName());
  List<DiskSpec> diskSpecs=new ArrayList<DiskSpec>();
  for (  DeviceId slot : templateVm.getVirtualDiskIds()) {
    VirtualDisk vmdk=(VirtualDisk)templateVm.getVirtualDevice(slot);
    DiskSpec spec=new DiskSpec();
    spec.setSize((int)(vmdk.getCapacityInKB() / (1024 * 1024)));
    spec.setDiskType(DiskType.SYSTEM_DISK);
    spec.setController(DiskScsiControllerType.LSI_CONTROLLER);
    diskSpecs.add(spec);
  }
  templateNode.setDisks(diskSpecs);
}

Fixed version (ground truth):
private void convertTemplateVm(){
  templateNode=new BaseNode(templateVm.getName());
  List<DiskSpec> diskSpecs=new ArrayList<DiskSpec>();
  for (  DeviceId slot : templateVm.getVirtualDiskIds()) {
    VirtualDisk vmdk=(VirtualDisk)templateVm.getVirtualDevice(slot);
    DiskSpec spec=new DiskSpec();
    spec.setSize((int)(vmdk.getCapacityInKB() / (1024 * 1024)));
    spec.setDiskType(DiskType.SYSTEM_DISK);
    spec.setController(DiskScsiControllerType.LSI_CONTROLLER);
    diskSpecs.add(spec);
  }
  templateNode.setDisks(diskSpecs);
  templateNode.setVmMobId(templateVm.getId());
}
Program: 48975
Project: 48975
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public boolean createVcVms(List<BaseNode> vNodes,StatusUpdater statusUpdator){
  if (vNodes.isEmpty()) {
    logger.info("String_Node_Str");
    return true;
  }
  Map<String,Folder> folders=createVcFolders(vNodes.get(0).getCluster());
  String clusterRpName=createVcResourcePools(vNodes);
  logger.info("String_Node_Str");
  FastCloneService<BaseNode> cloneSrv=new FastCloneServiceImpl<BaseNode>();
  cloneSrv.addResource(templateNode,cloneConcurrency);
  for (int i=0; i < vNodes.size(); i++) {
    BaseNode vNode=vNodes.get(i);
    vNode.setTargetVcDs(getVcDatastore(vNode));
    vNode.setTargetVcRp(getVcResourcePool(vNode,clusterRpName));
    vNode.setTargetVcFoler(folders.get(vNode.getGroupName()));
    vNode.setTargetVcHost(VcResourceUtils.findHost(vNode.getTargetHost()));
  }
  cloneSrv.addConsumers(vNodes);
  try {
    UpdateVmProgressCallback callback=new UpdateVmProgressCallback(clusterEntityMgr,statusUpdator,vNodes.get(0).getClusterName());
    cloneSrv.setProgressCallback(callback);
    logger.info("String_Node_Str");
    boolean success=cloneSrv.start();
    logger.info(cloneSrv.getCopied().size() + "String_Node_Str");
    return success;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public boolean createVcVms(List<BaseNode> vNodes,StatusUpdater statusUpdator){
  if (vNodes.isEmpty()) {
    logger.info("String_Node_Str");
    return true;
  }
  Map<String,Folder> folders=createVcFolders(vNodes.get(0).getCluster());
  String clusterRpName=createVcResourcePools(vNodes);
  logger.info("String_Node_Str");
  FastCloneService<BaseNode> cloneSrv=new FastCloneServiceImpl<BaseNode>();
  AbstractFastCopierFactory<BaseNode> copierFactory=new VmCloneSpFactory();
  cloneSrv.setFastCopierFactory(copierFactory);
  cloneSrv.addResource(templateNode,cloneConcurrency);
  for (  BaseNode vNode : vNodes) {
    vNode.setTargetVcDs(getVcDatastore(vNode));
    vNode.setTargetVcRp(getVcResourcePool(vNode,clusterRpName));
    vNode.setTargetVcFoler(folders.get(vNode.getGroupName()));
    vNode.setTargetVcHost(VcResourceUtils.findHost(vNode.getTargetHost()));
  }
  cloneSrv.addConsumers(vNodes);
  try {
    UpdateVmProgressCallback callback=new UpdateVmProgressCallback(clusterEntityMgr,statusUpdator,vNodes.get(0).getClusterName());
    cloneSrv.setProgressCallback(callback);
    logger.info("String_Node_Str");
    boolean success=cloneSrv.start();
    logger.info(cloneSrv.getCopied().size() + "String_Node_Str");
    return success;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw BddException.INTERNAL(e,e.getMessage());
  }
}
Program: 48980
Project: 48980
Buggy source:
private void setClusterStatus(JobExecution je){
  String successStatus=getJobParameters(je).getString(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM);
  String failureStatus=getJobParameters(je).getString(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM);
  String clusterName=getJobParameters(je).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  if (clusterName == null) {
    clusterName=getJobParameters(je).getString(JobConstants.TARGET_NAME_JOB_PARAM).split("String_Node_Str")[0];
  }
  Boolean success=TrackableTasklet.getFromJobExecutionContext(je.getExecutionContext(),JobConstants.CLUSTER_OPERATION_SUCCESS,Boolean.class);
  if (success == null || success) {
    success=(je.getExitStatus().equals(ExitStatus.COMPLETED));
  }
  ClusterStatus status=null;
  if (success & successStatus != null) {
    status=ClusterStatus.valueOf(successStatus);
  }
 else   if (!success && failureStatus != null) {
    status=ClusterStatus.valueOf(failureStatus);
  }
  logger.info("String_Node_Str" + clusterName + "String_Node_Str"+ status);
  ClusterEntity cluster=clusterEntityMgr.findByName(clusterName);
  if (cluster != null && status != null) {
    clusterEntityMgr.updateClusterStatus(clusterName,status);
  }
}

Fixed version (ground truth):
private void setClusterStatus(JobExecution je){
  String successStatus=getJobParameters(je).getString(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM);
  String failureStatus=getJobParameters(je).getString(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM);
  String clusterName=getJobParameters(je).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  if (clusterName == null) {
    clusterName=getJobParameters(je).getString(JobConstants.TARGET_NAME_JOB_PARAM).split("String_Node_Str")[0];
  }
  Boolean success=TrackableTasklet.getFromJobExecutionContext(je.getExecutionContext(),JobConstants.CLUSTER_OPERATION_SUCCESS,Boolean.class);
  if (success == null || success) {
    success=(je.getExitStatus().equals(ExitStatus.COMPLETED));
  }
  ClusterStatus status=null;
  if (success && successStatus != null) {
    status=ClusterStatus.valueOf(successStatus);
  }
 else   if (!success && failureStatus != null) {
    status=ClusterStatus.valueOf(failureStatus);
  }
  logger.info("String_Node_Str" + clusterName + "String_Node_Str"+ status);
  ClusterEntity cluster=clusterEntityMgr.findByName(clusterName);
  if (cluster != null && status != null) {
    clusterEntityMgr.updateClusterStatus(clusterName,status);
  }
}
Program: 48983
Project: 48983
Buggy source:
public static long makeVmMemoryDevisibleBy4(long memory){
  if ((memory % 4) == 0) {
    return memory;
  }
 else {
    long temp=memory / 4;
    return (temp + 1) * 4;
  }
}

Fixed version (ground truth):
public static long makeVmMemoryDevisibleBy4(long memory){
  return CommonUtil.makeVmMemoryDevisibleBy4(memory);
}
Program: 48985
Project: 48985
Buggy source:
@Override public void beforeJob(JobExecution je){
  clusterName=getJobParameters(je).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  if (clusterName == null) {
    clusterName=getJobParameters(je).getString(JobConstants.TARGET_NAME_JOB_PARAM).split("String_Node_Str")[0];
  }
  if (!subJob) {
    clusterEntityMgr.updateClusterTaskId(clusterName,je.getId());
  }
  if (recoverAutoFlagAfterJob != null) {
    setAutoFlag(false);
    if (preAutoFlag != null) {
      waitForManual();
    }
  }
  super.beforeJob(je);
}

Fixed version (ground truth):
@Override public void beforeJob(JobExecution je){
  clusterName=getJobParameters(je).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  if (clusterName == null) {
    clusterName=getJobParameters(je).getString(JobConstants.TARGET_NAME_JOB_PARAM).split("String_Node_Str")[0];
  }
  if (!subJob) {
    clusterEntityMgr.updateClusterTaskId(clusterName,je.getId());
  }
  if (recoverAutoFlagAfterJob != null) {
    setAutoFlag(false);
    if (preAutoFlag != null && preAutoFlag) {
      JobUtils.waitForManual(clusterName,executionService);
    }
  }
  super.beforeJob(je);
}
Program: 48987
Project: 48987
Buggy source:
/** 
 * deep clone a host object, use Gson as the tricky
 * @param other
 * @return
 */
public static AbstractHost clone(AbstractHost other){
  Gson gson=new Gson();
  return gson.fromJson(gson.toJson(other),AbstractHost.class);
}

Fixed version (ground truth):
/** 
 * deep clone a host object, use json as the tricky
 * @param other
 * @return
 */
public static AbstractHost clone(AbstractHost other){
  AbstractHost cloned=new AbstractHost(other.name);
  cloned.parent=other.parent;
  cloned.datastores=new ArrayList<AbstractDatastore>(other.datastores.size());
  for (  AbstractDatastore ad : other.datastores) {
    cloned.datastores.add(ad.clone());
  }
  return cloned;
}
Program: 48990
Project: 48990
Buggy source:
public static ClusterCreate getSimpleClusterSpec(String specName) throws Exception {
  String json=TestPlacementUtil.readJson(specName);
  logger.info(json);
  Gson gson=new Gson();
  try {
    return gson.fromJson(json,ClusterCreate.class);
  }
 catch (  Exception e) {
    logger.error(e.getMessage());
    throw e;
  }
}

Fixed version (ground truth):
public static ClusterCreate getSimpleClusterSpec(String specName) throws Exception {
  String json=TestPlacementUtil.readJson(specName);
  logger.info(json);
  ObjectMapper mapper=new ObjectMapper();
  try {
    return mapper.readValue(json,ClusterCreate.class);
  }
 catch (  Exception e) {
    logger.error(e.getMessage());
    throw e;
  }
}
Program: 48991
Project: 48991
Buggy source:
public static AbstractDatacenter getAbstractDatacenter(String fileName) throws Exception {
  String json=TestPlacementUtil.readJson(fileName);
  logger.info(json);
  Gson gson=new Gson();
  try {
    AbstractDatacenter dc=gson.fromJson(json,AbstractDatacenter.class);
    for (    AbstractCluster cluster : dc.getClusters()) {
      List<AbstractDatastore> dsList=new ArrayList<AbstractDatastore>();
      for (      AbstractDatastore datastore : cluster.getDatastores()) {
        AbstractDatastore ds=dc.findAbstractDatastore(datastore.getName());
        AuAssert.check(ds != null);
        dsList.add(ds);
      }
      cluster.setDatastores(dsList);
      for (      AbstractHost host : cluster.getHosts()) {
        List<AbstractDatastore> datastores=new ArrayList<AbstractDatastore>();
        for (        AbstractDatastore datastore : host.getDatastores()) {
          AbstractDatastore ds=dc.findAbstractDatastore(datastore.getName());
          AuAssert.check(ds != null);
          datastores.add(ds);
        }
        host.setDatastores(datastores);
        host.setParent(cluster);
      }
    }
    Assert.assertTrue(dc.findAbstractCluster("String_Node_Str") != null,"String_Node_Str");
    return dc;
  }
 catch (  Exception e) {
    logger.error(e.getMessage());
    throw e;
  }
}

Fixed version (ground truth):
public static AbstractDatacenter getAbstractDatacenter(String fileName) throws Exception {
  String json=TestPlacementUtil.readJson(fileName);
  logger.info(json);
  ObjectMapper mapper=new ObjectMapper();
  try {
    AbstractDatacenter dc=mapper.readValue(json,AbstractDatacenter.class);
    for (    AbstractCluster cluster : dc.getClusters()) {
      List<AbstractDatastore> dsList=new ArrayList<AbstractDatastore>();
      for (      AbstractDatastore datastore : cluster.getDatastores()) {
        AbstractDatastore ds=dc.findAbstractDatastore(datastore.getName());
        AuAssert.check(ds != null);
        dsList.add(ds);
      }
      cluster.setDatastores(dsList);
      for (      AbstractHost host : cluster.getHosts()) {
        List<AbstractDatastore> datastores=new ArrayList<AbstractDatastore>();
        for (        AbstractDatastore datastore : host.getDatastores()) {
          AbstractDatastore ds=dc.findAbstractDatastore(datastore.getName());
          AuAssert.check(ds != null);
          datastores.add(ds);
        }
        host.setDatastores(datastores);
        host.setParent(cluster);
      }
    }
    Assert.assertTrue(dc.findAbstractCluster("String_Node_Str") != null,"String_Node_Str");
    return dc;
  }
 catch (  Exception e) {
    logger.error(e.getMessage());
    throw e;
  }
}
Program: 48992
Project: 48992
Buggy source:
public static List<BaseNode> getExistedNodes(String fileName) throws Exception {
  ClusterCreate cluster=getSimpleClusterSpec(DC_SPLIT_CLUSTER_SPEC);
  String json=readJson(fileName);
  Gson gson=new Gson();
  List<BaseNode> existedNodes;
  try {
    existedNodes=gson.fromJson(json,new TypeToken<List<BaseNode>>(){
    }
.getType());
  }
 catch (  Exception e) {
    logger.error(e.getMessage());
    throw e;
  }
  Assert.assertNotNull(existedNodes);
  for (  BaseNode node : existedNodes) {
    node.setCluster(cluster);
    String groupName=node.getVmName().split("String_Node_Str")[1];
    node.setNodeGroup(cluster.getNodeGroup(groupName));
  }
  return existedNodes;
}

Fixed version (ground truth):
public static List<BaseNode> getExistedNodes(String fileName) throws Exception {
  ClusterCreate cluster=getSimpleClusterSpec(DC_SPLIT_CLUSTER_SPEC);
  String json=readJson(fileName);
  ObjectMapper mapper=new ObjectMapper();
  List<BaseNode> existedNodes;
  try {
    existedNodes=mapper.readValue(json,new TypeReference<List<BaseNode>>(){
    }
);
  }
 catch (  Exception e) {
    logger.error(e.getMessage());
    throw e;
  }
  Assert.assertNotNull(existedNodes);
  for (  BaseNode node : existedNodes) {
    node.setCluster(cluster);
    String groupName=node.getVmName().split("String_Node_Str")[1];
    node.setNodeGroup(cluster.getNodeGroup(groupName));
  }
  return existedNodes;
}
Program: 48993
Project: 48993
Buggy source:
public static String[] getDatastoreNamePattern(ClusterCreate clusterSpec,NodeGroupCreate nodeGroupSpec){
  AuAssert.check(nodeGroupSpec != null && nodeGroupSpec.getStorage() != null);
  String[] patterns;
  StorageRead storage=nodeGroupSpec.getStorage();
  if (storage.getNamePattern() != null) {
    patterns=(String[])storage.getNamePattern().toArray();
  }
 else   if (DatastoreType.SHARED.toString().equalsIgnoreCase(storage.getType())) {
    patterns=clusterSpec.getSharedPattern().toArray(new String[clusterSpec.getSharedPattern().size()]);
  }
 else   if (DatastoreType.LOCAL.toString().equalsIgnoreCase(storage.getType())) {
    patterns=clusterSpec.getLocalPattern().toArray(new String[clusterSpec.getLocalPattern().size()]);
  }
 else {
    if (!clusterSpec.getLocalPattern().isEmpty()) {
      patterns=clusterSpec.getLocalPattern().toArray(new String[clusterSpec.getLocalPattern().size()]);
    }
 else {
      patterns=clusterSpec.getSharedPattern().toArray(new String[clusterSpec.getSharedPattern().size()]);
    }
  }
  for (int i=0; i < patterns.length; i++) {
    patterns[i]=CommonUtil.getDatastoreJavaPattern(patterns[i]);
  }
  return patterns;
}

Fixed version (ground truth):
public static String[] getDatastoreNamePattern(ClusterCreate clusterSpec,NodeGroupCreate nodeGroupSpec){
  AuAssert.check(nodeGroupSpec != null && nodeGroupSpec.getStorage() != null);
  String[] patterns;
  StorageRead storage=nodeGroupSpec.getStorage();
  if (storage.getNamePattern() != null) {
    patterns=storage.getNamePattern().toArray(new String[storage.getNamePattern().size()]);
  }
 else   if (DatastoreType.SHARED.toString().equalsIgnoreCase(storage.getType())) {
    patterns=clusterSpec.getSharedPattern().toArray(new String[clusterSpec.getSharedPattern().size()]);
  }
 else   if (DatastoreType.LOCAL.toString().equalsIgnoreCase(storage.getType())) {
    patterns=clusterSpec.getLocalPattern().toArray(new String[clusterSpec.getLocalPattern().size()]);
  }
 else {
    if (!clusterSpec.getLocalPattern().isEmpty()) {
      patterns=clusterSpec.getLocalPattern().toArray(new String[clusterSpec.getLocalPattern().size()]);
    }
 else {
      patterns=clusterSpec.getSharedPattern().toArray(new String[clusterSpec.getSharedPattern().size()]);
    }
  }
  for (int i=0; i < patterns.length; i++) {
    patterns[i]=CommonUtil.getDatastoreJavaPattern(patterns[i]);
  }
  return patterns;
}
Program: 48995
Project: 48995
Buggy source:
public static void refreshDatastore(final VcCluster cl){
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body(){
      try {
        cl.update();
      }
 catch (      Exception e) {
        logger.info("String_Node_Str" + cl.getName() + "String_Node_Str",e);
      }
      List<VcDatastore> dss=cl.getAllDatastores();
      if (dss != null) {
        for (        VcDatastore ds : dss) {
          try {
            ds.update();
          }
 catch (          Exception e) {
            logger.info("String_Node_Str" + ds.getName() + "String_Node_Str",e);
          }
        }
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
public static void refreshDatastore(final VcCluster cl){
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body(){
      try {
        cl.update();
      }
 catch (      Exception e) {
        logger.info("String_Node_Str" + cl.getName() + "String_Node_Str",e);
      }
      List<VcDatastore> dss=cl.getAllDatastores();
      if (dss != null) {
        for (        VcDatastore ds : dss) {
          try {
            ds.update();
          }
 catch (          Exception e) {
            logger.info("String_Node_Str" + ds.getName() + "String_Node_Str",e);
          }
        }
      }
      try {
        List<VcHost> hosts=cl.getHosts();
        if (hosts != null) {
          for (          VcHost host : hosts) {
            try {
              host.update();
            }
 catch (            Exception e) {
              logger.info("String_Node_Str" + host.getName() + "String_Node_Str",e);
            }
          }
        }
      }
 catch (      Exception e) {
        logger.info("String_Node_Str" + cl.getName() + "String_Node_Str",e);
      }
      return null;
    }
  }
);
}
Program: 48997
Project: 48997
Buggy source:
public ClusterCreate getClusterSpec(String clusterName){
  ClusterCreate spec=clusterConfigMgr.getClusterConfig(clusterName);
  spec.setVcClusters(null);
  spec.setTemplateId(null);
  spec.setDistroMap(null);
  spec.setSharedPattern(null);
  spec.setLocalPattern(null);
  spec.setNetworking(null);
  spec.setRpNames(null);
  spec.setDsNames(null);
  spec.setNetworkName(null);
  spec.setName(null);
  spec.setDistro(null);
  spec.setValidateConfig(null);
  spec.setTopologyPolicy(null);
  spec.setHostToRackMap(null);
  spec.setHttpProxy(null);
  spec.setNoProxy(null);
  spec.setDistroVendor(null);
  spec.setDistroVersion(null);
  NodeGroupCreate[] groups=spec.getNodeGroups();
  if (groups != null) {
    for (    NodeGroupCreate group : groups) {
      group.setVcClusters(null);
      group.setGroupType(null);
      group.setRpNames(null);
      group.getStorage().setDsNames(null);
      group.getStorage().setNamePattern(null);
      group.setVmFolderPath(null);
      group.getStorage().setSplitPolicy(null);
      group.getStorage().setControllerType(null);
      group.getStorage().setAllocType(null);
    }
  }
  return spec;
}

Fixed version (ground truth):
public ClusterCreate getClusterSpec(String clusterName){
  ClusterCreate spec=clusterConfigMgr.getClusterConfig(clusterName);
  spec.setVcClusters(null);
  spec.setTemplateId(null);
  spec.setDistroMap(null);
  spec.setSharedPattern(null);
  spec.setLocalPattern(null);
  spec.setNetworking(null);
  spec.setRpNames(null);
  spec.setDsNames(null);
  spec.setNetworkName(null);
  spec.setName(null);
  spec.setDistro(null);
  spec.setValidateConfig(null);
  spec.setTopologyPolicy(null);
  spec.setHostToRackMap(null);
  spec.setHttpProxy(null);
  spec.setNoProxy(null);
  spec.setDistroVendor(null);
  spec.setDistroVersion(null);
  NodeGroupCreate[] groups=spec.getNodeGroups();
  if (groups != null) {
    for (    NodeGroupCreate group : groups) {
      group.setVcClusters(null);
      group.setGroupType(null);
      group.setRpNames(null);
      group.getStorage().setDsNames(null);
      group.getStorage().setNamePattern(null);
      group.setVmFolderPath(null);
      group.getStorage().setSplitPolicy(null);
      group.getStorage().setControllerType(null);
      group.getStorage().setAllocType(null);
      if (group.getPlacementPolicies() != null) {
        List<GroupAssociation> associations=group.getPlacementPolicies().getGroupAssociations();
        if (associations != null && associations.isEmpty()) {
          group.getPlacementPolicies().setGroupAssociations(null);
        }
      }
    }
  }
  return spec;
}
Program: 48998
Project: 48998
Buggy source:
public static void verifyNodesStatus(List<NodeEntity> nodes,NodeStatus expectedStatus,boolean ignoreMissing){
  for (  NodeEntity node : nodes) {
    if (node.getStatus() != expectedStatus) {
      if (ignoreMissing && node.getStatus() == NodeStatus.NOT_EXIST) {
        continue;
      }
      if (expectedStatus == NodeStatus.VM_READY) {
        VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getMoId());
        if (vm != null && vm.isPoweredOn() && (VcVmUtil.getIpAddress(vm,false) != null)) {
          continue;
        }
      }
      throw ClusteringServiceException.VM_STATUS_ERROR(node.getVmName(),node.getStatus().toString(),expectedStatus.toString());
    }
  }
}

Fixed version (ground truth):
public static void verifyNodesStatus(List<NodeEntity> nodes,NodeStatus expectedStatus,boolean ignoreMissing){
  for (  NodeEntity node : nodes) {
    if (node.getStatus() != expectedStatus) {
      if (ignoreMissing && node.getStatus() == NodeStatus.NOT_EXIST) {
        continue;
      }
      if (expectedStatus == NodeStatus.VM_READY) {
        VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getMoId());
        if (vm == null || !vm.isPoweredOn() || (VcVmUtil.getIpAddress(vm,false) == null)) {
          throw ClusteringServiceException.VM_STATUS_ERROR(node.getVmName(),node.getStatus().toString(),expectedStatus.toString());
        }
        String haFlag=node.getNodeGroup().getHaFlag();
        if (haFlag != null && Constants.HA_FLAG_FT.equals(haFlag.toLowerCase())) {
          if (!VcVmUtil.verifyFTState(vm)) {
            logger.info("String_Node_Str" + vm.getName() + "String_Node_Str"+ "String_Node_Str"+ vm.getFTState()+ "String_Node_Str");
            throw ClusteringServiceException.ENABLE_FT_FAILED(null,node.getVmName());
          }
        }
      }
    }
  }
}
Program: 48999
Project: 48999
Buggy source:
/** 
 * separate vc unreachable node from existing node list. if the node is powered off, or powered on but ip address is not accessible, remove the node from good nodes
 * @param existingNodes
 * @param deletedNodes
 * @param occupiedIps
 */
public static void separateVcUnreachableNodes(List<BaseNode> existingNodes,List<BaseNode> deletedNodes,Set<String> occupiedIps){
  for (  BaseNode node : existingNodes) {
    if (node.getVmMobId() == null) {
      deletedNodes.add(node);
      continue;
    }
    VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getVmMobId());
    if (vm == null || vm.isPoweredOff() || (VcVmUtil.getIpAddress(vm,false) == null)) {
      deletedNodes.add(node);
      continue;
    }
    occupiedIps.add(node.getIpAddress());
  }
  existingNodes.removeAll(deletedNodes);
}

Fixed version (ground truth):
/** 
 * separate vc unreachable node from existing node list. if the node is powered off, or powered on but ip address is not accessible, remove the node from good nodes
 * @param existingNodes
 * @param deletedNodes
 * @param occupiedIps
 */
public static void separateVcUnreachableNodes(List<BaseNode> existingNodes,List<BaseNode> deletedNodes,Set<String> occupiedIps){
  for (  BaseNode node : existingNodes) {
    if (node.getVmMobId() == null) {
      deletedNodes.add(node);
      continue;
    }
    VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getVmMobId());
    if (vm == null || vm.isPoweredOff() || (VcVmUtil.getIpAddress(vm,false) == null)) {
      deletedNodes.add(node);
      continue;
    }
    String haFlag=node.getNodeGroup().getHaFlag();
    if (haFlag != null && Constants.HA_FLAG_FT.equals(haFlag.toLowerCase())) {
      if (!VcVmUtil.verifyFTState(vm)) {
        logger.info("String_Node_Str" + vm.getName() + "String_Node_Str"+ "String_Node_Str"+ vm.getFTState()+ "String_Node_Str");
        deletedNodes.add(node);
        continue;
      }
    }
    occupiedIps.add(node.getIpAddress());
  }
  existingNodes.removeAll(deletedNodes);
}
Program: 49001
Project: 49001
Buggy source:
public List<String> getVolumns(){
  List<String> volumns=new ArrayList<String>();
  for (  DiskEntity disk : disks) {
    volumns.add(disk.getDeviceName());
  }
  return volumns;
}

Fixed version (ground truth):
public List<String> getVolumns(){
  List<String> volumns=new ArrayList<String>();
  for (  DiskEntity disk : disks) {
    if (!DiskType.SWAP_DISK.getType().equals(disk.getDiskType()))     volumns.add(disk.getDeviceName());
  }
  return volumns;
}
Program: 49002
Project: 49002
Buggy source:
private void convertStorage(NodeGroupCreate group,NodeGroupEntity groupEntity,Set<String> roles){
  if (group.getStorage() != null) {
    groupEntity.setStorageSize(group.getStorage().getSizeGB());
    List<String> groupRoles=group.getRoles();
    if (groupRoles.contains(HadoopRole.ZOOKEEPER_ROLE.toString()) && groupRoles.size() == 1) {
      groupEntity.setDiskBisect(true);
    }
 else {
      groupEntity.setDiskBisect(false);
    }
    String storageType=group.getStorage().getType();
    if (storageType != null) {
      if (storageType.equalsIgnoreCase(DatastoreType.TEMPFS.name())) {
        groupEntity.setStorageType(DatastoreType.TEMPFS);
        roles.add(HadoopRole.TEMPFS_CLIENT_ROLE.toString());
      }
 else       if (storageType.equalsIgnoreCase(DatastoreType.LOCAL.name())) {
        groupEntity.setStorageType(DatastoreType.LOCAL);
      }
 else {
        groupEntity.setStorageType(DatastoreType.SHARED);
      }
    }
    groupEntity.setVcDatastoreNameList(group.getStorage().getDsNames());
  }
  if (groupEntity.getStorageType() == DatastoreType.LOCAL) {
    if (group.getHaFlag() != null && Constants.HA_FLAG_FT.equals(group.getHaFlag().toLowerCase())) {
      throw ClusterConfigException.LOCAL_STORAGE_USED_FOR_FT_GROUP(group.getName());
    }
  }
}

Fixed version (ground truth):
private void convertStorage(NodeGroupCreate group,NodeGroupEntity groupEntity,Set<String> roles){
  if (group.getStorage() != null) {
    groupEntity.setStorageSize(group.getStorage().getSizeGB());
    List<String> groupRoles=group.getRoles();
    String storageType=group.getStorage().getType();
    if (storageType != null) {
      if (storageType.equalsIgnoreCase(DatastoreType.TEMPFS.name())) {
        groupEntity.setStorageType(DatastoreType.TEMPFS);
        roles.add(HadoopRole.TEMPFS_CLIENT_ROLE.toString());
      }
 else       if (storageType.equalsIgnoreCase(DatastoreType.LOCAL.name())) {
        groupEntity.setStorageType(DatastoreType.LOCAL);
      }
 else {
        groupEntity.setStorageType(DatastoreType.SHARED);
      }
    }
    groupEntity.setVcDatastoreNameList(group.getStorage().getDsNames());
  }
  if (groupEntity.getStorageType() == DatastoreType.LOCAL) {
    if (group.getHaFlag() != null && Constants.HA_FLAG_FT.equals(group.getHaFlag().toLowerCase())) {
      throw ClusterConfigException.LOCAL_STORAGE_USED_FOR_FT_GROUP(group.getName());
    }
  }
}
Program: 49004
Project: 49004
Buggy source:
public ClusterCreate getClusterSpec(String clusterName){
  ClusterCreate spec=clusterConfigMgr.getClusterConfig(clusterName);
  spec.setVcClusters(null);
  spec.setTemplateId(null);
  spec.setDistroMap(null);
  spec.setSharedPattern(null);
  spec.setLocalPattern(null);
  spec.setNetworking(null);
  spec.setRpNames(null);
  spec.setDsNames(null);
  spec.setNetworkName(null);
  spec.setName(null);
  spec.setDistro(null);
  spec.setValidateConfig(null);
  spec.setTopologyPolicy(null);
  spec.setHostToRackMap(null);
  spec.setHttpProxy(null);
  spec.setNoProxy(null);
  spec.setDistroVendor(null);
  spec.setDistroVersion(null);
  NodeGroupCreate[] groups=spec.getNodeGroups();
  if (groups != null) {
    for (    NodeGroupCreate group : groups) {
      group.setVcClusters(null);
      group.setGroupType(null);
      group.setRpNames(null);
      group.getStorage().setDsNames(null);
      group.getStorage().setNamePattern(null);
      group.getStorage().setDiskBisect(false);
      group.setVmFolderPath(null);
    }
  }
  return spec;
}

Fixed version (ground truth):
public ClusterCreate getClusterSpec(String clusterName){
  ClusterCreate spec=clusterConfigMgr.getClusterConfig(clusterName);
  spec.setVcClusters(null);
  spec.setTemplateId(null);
  spec.setDistroMap(null);
  spec.setSharedPattern(null);
  spec.setLocalPattern(null);
  spec.setNetworking(null);
  spec.setRpNames(null);
  spec.setDsNames(null);
  spec.setNetworkName(null);
  spec.setName(null);
  spec.setDistro(null);
  spec.setValidateConfig(null);
  spec.setTopologyPolicy(null);
  spec.setHostToRackMap(null);
  spec.setHttpProxy(null);
  spec.setNoProxy(null);
  spec.setDistroVendor(null);
  spec.setDistroVersion(null);
  NodeGroupCreate[] groups=spec.getNodeGroups();
  if (groups != null) {
    for (    NodeGroupCreate group : groups) {
      group.setVcClusters(null);
      group.setGroupType(null);
      group.setRpNames(null);
      group.getStorage().setDsNames(null);
      group.getStorage().setNamePattern(null);
      group.setVmFolderPath(null);
      group.getStorage().setSplitPolicy(null);
      group.getStorage().setControllerType(null);
      group.getStorage().setAllocType(null);
    }
  }
  return spec;
}
Program: 49007
Project: 49007
Buggy source:
private VcResourcePool getVcResourcePool(BaseNode vNode,final String clusterRpName){
  try {
    String vcRPName="String_Node_Str";
    if (CommonUtil.isBlank(vNode.getTargetRp())) {
      vcRPName=clusterRpName + "String_Node_Str" + vNode.getNodeGroup().getName();
    }
 else {
      vcRPName=vNode.getTargetRp() + "String_Node_Str" + clusterRpName+ "String_Node_Str"+ vNode.getNodeGroup().getName();
    }
    VcResourcePool rp=VcResourceUtils.findRPInVCCluster(vNode.getTargetVcCluster(),vcRPName);
    if (rp == null) {
      throw ClusteringServiceException.TARGET_VC_RP_NOT_FOUND(vNode.getTargetVcCluster(),vNode.getTargetRp());
    }
    return rp;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + vNode.getTargetRp() + "String_Node_Str"+ vNode.getTargetVcCluster(),e);
    throw ClusteringServiceException.TARGET_VC_RP_NOT_FOUND(vNode.getTargetVcCluster(),vNode.getTargetRp());
  }
}

Fixed version (ground truth):
private VcResourcePool getVcResourcePool(BaseNode vNode,final String clusterRpName){
  try {
    String vcRPName="String_Node_Str";
    VcCluster cluster=VcResourceUtils.findVcCluster(vNode.getTargetVcCluster());
    if (!cluster.getConfig().getDRSEnabled()) {
      logger.debug("String_Node_Str" + vNode.getTargetVcCluster() + "String_Node_Str");
      return cluster.getRootRP();
    }
    if (CommonUtil.isBlank(vNode.getTargetRp())) {
      vcRPName=clusterRpName + "String_Node_Str" + vNode.getNodeGroup().getName();
    }
 else {
      vcRPName=vNode.getTargetRp() + "String_Node_Str" + clusterRpName+ "String_Node_Str"+ vNode.getNodeGroup().getName();
    }
    VcResourcePool rp=VcResourceUtils.findRPInVCCluster(vNode.getTargetVcCluster(),vcRPName);
    if (rp == null) {
      throw ClusteringServiceException.TARGET_VC_RP_NOT_FOUND(vNode.getTargetVcCluster(),vNode.getTargetRp());
    }
    return rp;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + vNode.getTargetRp() + "String_Node_Str"+ vNode.getTargetVcCluster(),e);
    throw ClusteringServiceException.TARGET_VC_RP_NOT_FOUND(vNode.getTargetVcCluster(),vNode.getTargetRp());
  }
}
Program: 49008
Project: 49008
Buggy source:
private void executeResourcePoolStoreProcedures(Callable<Void>[] defineSPs,String type,String clusterName) throws InterruptedException {
  NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
  ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,defineSPs,callback);
  if (result == null) {
    logger.error("String_Node_Str" + type + "String_Node_Str");
    throw ClusteringServiceException.CREATE_RESOURCE_POOL_FAILED(clusterName);
  }
  int total=0;
  boolean success=true;
  for (int i=0; i < defineSPs.length; i++) {
    if (result[i].finished && result[i].throwable == null) {
      ++total;
    }
 else     if (result[i].throwable != null) {
      logger.error("String_Node_Str" + type + "String_Node_Str",result[i].throwable);
      success=false;
    }
  }
  logger.info(total + "String_Node_Str" + type+ "String_Node_Str");
  if (!success) {
    throw ClusteringServiceException.CREATE_RESOURCE_POOL_FAILED(clusterName);
  }
}

Fixed version (ground truth):
private void executeResourcePoolStoreProcedures(Callable<Void>[] defineSPs,String type,String clusterName) throws InterruptedException {
  if (defineSPs.length == 0) {
    logger.debug("String_Node_Str");
    return;
  }
  NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
  ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,defineSPs,callback);
  if (result == null) {
    logger.error("String_Node_Str" + type + "String_Node_Str");
    throw ClusteringServiceException.CREATE_RESOURCE_POOL_FAILED(clusterName);
  }
  int total=0;
  boolean success=true;
  for (int i=0; i < defineSPs.length; i++) {
    if (result[i].finished && result[i].throwable == null) {
      ++total;
    }
 else     if (result[i].throwable != null) {
      logger.error("String_Node_Str" + type + "String_Node_Str",result[i].throwable);
      success=false;
    }
  }
  logger.info(total + "String_Node_Str" + type+ "String_Node_Str");
  if (!success) {
    throw ClusteringServiceException.CREATE_RESOURCE_POOL_FAILED(clusterName);
  }
}
Program: 49010
Project: 49010
Buggy source:
private static VmOperation getOperation(Callable<Void> sp){
  if (sp instanceof CreateVMFolderSP) {
    return VmOperation.CREATE_FOLDER;
  }
 else   if (sp instanceof StartVmSP) {
    return VmOperation.START_VM;
  }
 else   if (sp instanceof StopVmSP) {
    return VmOperation.STOP_VM;
  }
 else   if (sp instanceof DeleteVMFolderSP) {
    return VmOperation.DELETE_FOLDER;
  }
 else   if (sp instanceof DeleteVmByIdSP) {
    return VmOperation.DELETE_VM;
  }
 else   if (sp instanceof CreateVmSP) {
    return VmOperation.CREATE_VM;
  }
 else   if (sp instanceof ConfigIOShareSP) {
    return VmOperation.RECONFIGURE_VM;
  }
 else {
    logger.error("String_Node_Str" + sp);
    return null;
  }
}

Fixed version (ground truth):
private static VmOperation getOperation(Callable<Void> sp){
  if (sp instanceof CreateVMFolderSP) {
    return VmOperation.CREATE_FOLDER;
  }
 else   if (sp instanceof StartVmSP) {
    return VmOperation.START_VM;
  }
 else   if (sp instanceof StopVmSP) {
    return VmOperation.STOP_VM;
  }
 else   if (sp instanceof DeleteVMFolderSP) {
    return VmOperation.DELETE_FOLDER;
  }
 else   if (sp instanceof DeleteVmByIdSP) {
    return VmOperation.DELETE_VM;
  }
 else   if (sp instanceof CreateVmSP) {
    return VmOperation.CREATE_VM;
  }
 else   if (sp instanceof ConfigIOShareSP) {
    return VmOperation.RECONFIGURE_VM;
  }
 else   if (sp instanceof CreateResourcePoolSP) {
    return VmOperation.CREATE_RP;
  }
 else {
    logger.error("String_Node_Str" + sp);
    return null;
  }
}
Program: 49013
Project: 49013
Buggy source:
public static void setNetworkSchema(ConfigSpecImpl spec,VcCluster cluster,NetworkSchema networkSchema) throws Exception {
  List<VirtualDeviceSpec> changes=new ArrayList<VirtualDeviceSpec>();
  for (  NetworkSchema.Network network : networkSchema.networks) {
    VcNetwork vN=cluster.getNetwork(network.vcNetwork);
    AuAssert.check(vN != null);
    VirtualDeviceSpec deviceSpec=VmConfigUtil.createNetworkDevice(VmConfigUtil.EthernetControllerType.VMXNET3,network.nicLabel,vN);
    changes.add(deviceSpec);
  }
  spec.setDeviceChange(changes.toArray(new VirtualDeviceSpec[changes.size()]));
}

Fixed version (ground truth):
public static void setNetworkSchema(ConfigSpecImpl spec,VcCluster cluster,NetworkSchema networkSchema,VcVirtualMachine vcVm) throws Exception {
  List<VirtualDeviceSpec> changes=new ArrayList<VirtualDeviceSpec>();
  for (  NetworkSchema.Network network : networkSchema.networks) {
    VcNetwork vN=cluster.getNetwork(network.vcNetwork);
    AuAssert.check(vN != null);
    if (network.nicLabel != null && vcVm.getDeviceByLabel(network.nicLabel) != null) {
      changes.add(vcVm.reconfigNetworkSpec(network.nicLabel,vN));
    }
 else {
      VirtualDeviceSpec deviceSpec=VmConfigUtil.createNetworkDevice(VmConfigUtil.EthernetControllerType.VMXNET3,network.nicLabel,vN);
      changes.add(deviceSpec);
    }
  }
  spec.setDeviceChange(changes.toArray(new VirtualDeviceSpec[changes.size()]));
}
Program: 49014
Project: 49014
Buggy source:
/** 
 * Get a virtual device by device label.
 * @param label virtual device label
 * @return virtual device, null if not found
 */
protected VirtualDevice getDeviceByLabel(String label){
  VirtualDevice target=null;
  for (  VirtualDevice device : getDevice()) {
    if (device.getDeviceInfo().getLabel().equalsIgnoreCase(label)) {
      target=device;
      break;
    }
  }
  return target;
}

Fixed version (ground truth):
/** 
 * Get a virtual device by device label.
 * @param label virtual device label
 * @return virtual device, null if not found
 */
public VirtualDevice getDeviceByLabel(String label){
  VirtualDevice target=null;
  for (  VirtualDevice device : getDevice()) {
    if (device.getDeviceInfo().getLabel().equalsIgnoreCase(label)) {
      target=device;
      break;
    }
  }
  return target;
}
Program: 49016
Project: 49016
Buggy source:
public synchronized void init(){
  if (!initialized) {
    Configuration.approveBootstrapInstanceId(Configuration.BootstrapUsage.ALLOWED);
    Configuration.approveBootstrapInstanceId(Configuration.BootstrapUsage.FINALIZED);
    VcContext.initVcContext();
    new VcEventRouter();
    CmsWorker.addPeriodic(new VcInventory.SyncInventoryRequest());
    VcInventory.loadInventory();
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    new VcEventProcessor(getClusterEntityMgr());
    Scheduler.init(50,50);
    CmsWorker.addPeriodic(new ClusterNodeUpdator(getClusterEntityMgr()));
    snapshotTemplateVM();
    convertTemplateVm();
    initialized=true;
  }
}

Fixed version (ground truth):
public synchronized void init(){
  if (!initialized) {
    Configuration.approveBootstrapInstanceId(Configuration.BootstrapUsage.ALLOWED);
    Configuration.approveBootstrapInstanceId(Configuration.BootstrapUsage.FINALIZED);
    VcContext.initVcContext();
    new VcEventRouter();
    CmsWorker.addPeriodic(new VcInventory.SyncInventoryRequest());
    VcInventory.loadInventory();
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    new VcEventProcessor(getClusterEntityMgr());
    Scheduler.init(50,50);
    CmsWorker.addPeriodic(new ClusterNodeUpdator(getClusterEntityMgr()));
    snapshotTemplateVM();
    loadTemplateNetworkLable();
    convertTemplateVm();
    initialized=true;
  }
}
Program: 49017
Project: 49017
Buggy source:
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  List<BaseNode> deletedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_DELETED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  Set<String> deletedNodeNames=new HashSet<String>();
  if (deletedNodes != null) {
    for (    BaseNode node : deletedNodes) {
      deletedNodeNames.add(node.getVmName());
    }
  }
  addNodeToMetaData(clusterName,addedNodes,deletedNodeNames);
  removeDeletedNode(clusterName,deletedNodeNames);
  Boolean deleted=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_DELETE_VM_OPERATION_SUCCESS,Boolean.class);
  Boolean created=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_CREATE_VM_OPERATION_SUCCESS,Boolean.class);
  if (deleted != null && !deleted) {
    logger.error("String_Node_Str");
    throw ClusteringServiceException.DELETE_CLUSTER_VM_FAILED(clusterName);
  }
  if (created != null && !created) {
    throw ClusteringServiceException.VM_CREATION_FAILED(clusterName);
  }
  if (created != null) {
    String verifyScope=getJobParameters(chunkContext).getString(JobConstants.VERIFY_NODE_STATUS_SCOPE_PARAM);
    if (verifyScope != null && verifyScope.equals(JobConstants.GROUP_NODE_SCOPE_VALUE)) {
      String groupName=getJobParameters(chunkContext).getString(JobConstants.GROUP_NAME_JOB_PARAM);
      long oldInstanceNum=getJobParameters(chunkContext).getLong(JobConstants.GROUP_INSTANCE_OLD_NUMBER_JOB_PARAM);
      verifyGroupVmReady(clusterName,groupName,oldInstanceNum);
    }
 else {
      verifyAllVmReady(clusterName);
    }
  }
  updateVhmMasterMoid(clusterName);
  return RepeatStatus.FINISHED;
}

Fixed version (ground truth):
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  List<BaseNode> deletedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_DELETED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  Set<String> deletedNodeNames=new HashSet<String>();
  if (deletedNodes != null) {
    for (    BaseNode node : deletedNodes) {
      deletedNodeNames.add(node.getVmName());
    }
  }
  addNodeToMetaData(clusterName,addedNodes,deletedNodeNames);
  removeDeletedNode(clusterName,deletedNodeNames);
  updateVhmMasterMoid(clusterName);
  return RepeatStatus.FINISHED;
}
Program: 49018
Project: 49018
Buggy source:
public boolean isStrictAssociated(){
  return strictAssociated;
}

Fixed version (ground truth):
public boolean isStrictAssociated(){
  return strictAssociated == null ? false : strictAssociated;
}
Program: 49023
Project: 49023
Buggy source:
@Transactional(propagation=Propagation.MANDATORY) public static void validHostNumber(ClusterEntityManager clusterEntityMgr,NodeGroupEntity nodeGroup,int instanceNum){
  Set<NodeGroupAssociation> associations=nodeGroup.getGroupAssociations();
  if (associations != null && !associations.isEmpty()) {
    AuAssert.check(associations.size() == 1,"String_Node_Str");
    NodeGroupAssociation association=associations.iterator().next();
    if (association.getAssociationType() == GroupAssociationType.STRICT) {
      NodeGroupEntity refGroup=clusterEntityMgr.findByName(nodeGroup.getCluster(),association.getReferencedGroup());
      AuAssert.check(refGroup != null,"String_Node_Str");
      int hostNum=1;
      int refHostNum=refGroup.getDefineInstanceNum();
      if (nodeGroup.getInstancePerHost() != null) {
        hostNum=instanceNum / nodeGroup.getInstancePerHost();
      }
      if (refGroup.getInstancePerHost() != null) {
        refHostNum=refGroup.getDefineInstanceNum() / refGroup.getInstancePerHost();
      }
      if (hostNum > refHostNum) {
        throw BddException.INVALID_PARAMETER("String_Node_Str",new StringBuilder(100).append(instanceNum).append("String_Node_Str" + "String_Node_Str").toString());
      }
    }
  }
}

Fixed version (ground truth):
public static void validHostNumber(ClusterEntityManager clusterEntityMgr,NodeGroupEntity nodeGroup,int instanceNum){
  Set<NodeGroupAssociation> associations=nodeGroup.getGroupAssociations();
  if (associations != null && !associations.isEmpty()) {
    AuAssert.check(associations.size() == 1,"String_Node_Str");
    NodeGroupAssociation association=associations.iterator().next();
    if (association.getAssociationType() == GroupAssociationType.STRICT) {
      NodeGroupEntity refGroup=clusterEntityMgr.findByName(nodeGroup.getCluster(),association.getReferencedGroup());
      AuAssert.check(refGroup != null,"String_Node_Str");
      int hostNum=1;
      int refHostNum=refGroup.getDefineInstanceNum();
      if (nodeGroup.getInstancePerHost() != null) {
        hostNum=instanceNum / nodeGroup.getInstancePerHost();
      }
      if (refGroup.getInstancePerHost() != null) {
        refHostNum=refGroup.getDefineInstanceNum() / refGroup.getInstancePerHost();
      }
      if (hostNum > refHostNum) {
        throw BddException.INVALID_PARAMETER("String_Node_Str",new StringBuilder(100).append(instanceNum).append("String_Node_Str" + "String_Node_Str").toString());
      }
    }
  }
}
Program: 49024
Project: 49024
Buggy source:
@Override public boolean deleteCluster(final String name,StatusUpdater statusUpdator){
  logger.info("String_Node_Str" + name);
  List<NodeEntity> nodes=clusterEntityMgr.findAllNodes(name);
  List<BaseNode> vNodes=JobUtils.convertNodeEntities(null,null,nodes);
  boolean deleted=syncDeleteVMs(vNodes,statusUpdator);
  if (nodes.size() > 0) {
    try {
      deleteFolders(vNodes.get(0));
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
    }
  }
  return deleted;
}

Fixed version (ground truth):
@Override public boolean deleteCluster(final String name,StatusUpdater statusUpdator){
  logger.info("String_Node_Str" + name);
  List<NodeEntity> nodes=clusterEntityMgr.findAllNodes(name);
  List<BaseNode> vNodes=JobUtils.convertNodeEntities(null,null,nodes);
  boolean deleted=syncDeleteVMs(vNodes,statusUpdator);
  if (nodes.size() > 0) {
    try {
      deleteChildRps(name,vNodes);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
    }
    try {
      deleteFolders(vNodes.get(0));
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
    }
  }
  return deleted;
}
Program: 49025
Project: 49025
Buggy source:
@Override public Void call() throws Exception {
  final VcVirtualMachine vcVm=VcCache.getIgnoreMissing(vmId);
  if (vcVm == null) {
    logger.info("String_Node_Str" + vmId + "String_Node_Str");
    return null;
  }
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      FaultToleranceConfigInfo info=vcVm.getConfig().getFtInfo();
      if (info != null && info.getRole() == 1) {
        logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
        vcVm.turnOffFT();
      }
      vcVm.destroy();
      return null;
    }
    protected boolean isTaskSession(){
      return true;
    }
  }
);
  return null;
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  final VcVirtualMachine vcVm=VcCache.getIgnoreMissing(vmId);
  if (vcVm == null) {
    logger.info("String_Node_Str" + vmId + "String_Node_Str");
    return null;
  }
  VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      FaultToleranceConfigInfo info=vcVm.getConfig().getFtInfo();
      if (info != null && info.getRole() == 1) {
        logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
        vcVm.turnOffFT();
      }
      if (vcVm.isPoweredOn()) {
        vcVm.powerOff();
      }
      vcVm.destroy();
      return null;
    }
    protected boolean isTaskSession(){
      return true;
    }
  }
);
  return null;
}
Program: 49026
Project: 49026
Buggy source:
@Override protected Void body() throws Exception {
  FaultToleranceConfigInfo info=vcVm.getConfig().getFtInfo();
  if (info != null && info.getRole() == 1) {
    logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
    vcVm.turnOffFT();
  }
  vcVm.destroy();
  return null;
}

Fixed version (ground truth):
@Override protected Void body() throws Exception {
  FaultToleranceConfigInfo info=vcVm.getConfig().getFtInfo();
  if (info != null && info.getRole() == 1) {
    logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
    vcVm.turnOffFT();
  }
  if (vcVm.isPoweredOn()) {
    vcVm.powerOff();
  }
  vcVm.destroy();
  return null;
}