nus-yam/ex-repair huggingface dataset:
Program: 106668
Project: 106668
Buggy source:
public Long getJobId(){
  return jobId;
}

Fixed version (ground truth):
public Long getJobId(){
  return jobId.getValue();
}
Program: 106669
Project: 106669
Buggy source:
public void setId(Long id){
  this.id=id;
}

Fixed version (ground truth):
public void setId(Long id){
  this.id.setValue(id);
}
Program: 106670
Project: 106670
Buggy source:
public Long getId(){
  return id;
}

Fixed version (ground truth):
public Long getId(){
  return id.getValue();
}
Program: 106675
Project: 106675
Buggy source:
public SummedCapacity(){
}

Fixed version (ground truth):
public SummedCapacity(long sumUsed,long sumReserved,long sumTotal,short capacityType,Long clusterId,Long podId){
  super();
  this.sumUsed=sumUsed;
  this.sumReserved=sumReserved;
  this.sumTotal=sumTotal;
  this.capacityType=capacityType;
  this.clusterId=clusterId;
  this.podId=podId;
}
Program: 106676
Project: 106676
Buggy source:
@Override public List<CapacityResponse> createCapacityResponse(List<? extends Capacity> result,DecimalFormat format){
  List<CapacityResponse> capacityResponses=new ArrayList<CapacityResponse>();
  List<CapacityVO> summedCapacities=sumCapacities(result);
  for (  CapacityVO summedCapacity : summedCapacities) {
    CapacityResponse capacityResponse=new CapacityResponse();
    capacityResponse.setCapacityTotal(summedCapacity.getTotalCapacity());
    capacityResponse.setCapacityType(summedCapacity.getCapacityType());
    capacityResponse.setCapacityUsed(summedCapacity.getUsedCapacity());
    if (summedCapacity.getPodId() != null) {
      capacityResponse.setPodId(summedCapacity.getPodId());
      if (summedCapacity.getPodId() > 0) {
        HostPodVO pod=ApiDBUtils.findPodById(summedCapacity.getPodId());
        if (pod != null) {
          capacityResponse.setPodName(pod.getName());
        }
      }
 else {
        capacityResponse.setPodName("String_Node_Str");
      }
    }
    capacityResponse.setZoneId(summedCapacity.getDataCenterId());
    capacityResponse.setZoneName(ApiDBUtils.findZoneById(summedCapacity.getDataCenterId()).getName());
    if (summedCapacity.getTotalCapacity() != 0) {
      capacityResponse.setPercentUsed(format.format((float)summedCapacity.getUsedCapacity() / (float)summedCapacity.getTotalCapacity() * 100f));
    }
 else {
      capacityResponse.setPercentUsed(format.format(0L));
    }
    capacityResponse.setObjectName("String_Node_Str");
    capacityResponses.add(capacityResponse);
  }
  return capacityResponses;
}

Fixed version (ground truth):
@Override public List<CapacityResponse> createCapacityResponse(List<? extends Capacity> result,DecimalFormat format){
  List<CapacityResponse> capacityResponses=new ArrayList<CapacityResponse>();
  for (  Capacity summedCapacity : result) {
    CapacityResponse capacityResponse=new CapacityResponse();
    capacityResponse.setCapacityTotal(summedCapacity.getTotalCapacity());
    capacityResponse.setCapacityType(summedCapacity.getCapacityType());
    capacityResponse.setCapacityUsed(summedCapacity.getUsedCapacity());
    if (summedCapacity.getPodId() != null) {
      capacityResponse.setPodId(summedCapacity.getPodId());
      if (summedCapacity.getPodId() > 0) {
        HostPodVO pod=ApiDBUtils.findPodById(summedCapacity.getPodId());
        if (pod != null) {
          capacityResponse.setPodName(pod.getName());
        }
      }
 else {
        capacityResponse.setPodName("String_Node_Str");
      }
    }
    capacityResponse.setZoneId(summedCapacity.getDataCenterId());
    capacityResponse.setZoneName(ApiDBUtils.findZoneById(summedCapacity.getDataCenterId()).getName());
    if (summedCapacity.getTotalCapacity() != 0) {
      capacityResponse.setPercentUsed(format.format((float)summedCapacity.getUsedCapacity() / (float)summedCapacity.getTotalCapacity() * 100f));
    }
 else {
      capacityResponse.setPercentUsed(format.format(0L));
    }
    capacityResponse.setObjectName("String_Node_Str");
    capacityResponses.add(capacityResponse);
  }
  return capacityResponses;
}
Program: 106677
Project: 106677
Buggy source:
@Override public List<CapacityVO> listCapacities(ListCapacityCmd cmd){
  Filter searchFilter=new Filter(CapacityVO.class,"String_Node_Str",true,null,null);
  SearchCriteria<CapacityVO> sc=_capacityDao.createSearchCriteria();
  List<CapacityVO> capacities=new LinkedList<CapacityVO>();
  Integer type=cmd.getType();
  Long zoneId=cmd.getZoneId();
  Long podId=cmd.getPodId();
  Long hostId=cmd.getHostId();
  zoneId=_accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(),zoneId);
  if (type != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,type);
  }
  if (zoneId != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,zoneId);
  }
  if (podId != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,podId);
  }
  if (hostId != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,hostId);
  }
  capacities=_capacityDao.search(sc,searchFilter);
  if (type == null || type == Capacity.CAPACITY_TYPE_SECONDARY_STORAGE) {
    capacities.addAll(_storageMgr.getSecondaryStorageUsedStats(hostId,podId,zoneId));
  }
  if (type == null || type == Capacity.CAPACITY_TYPE_STORAGE) {
    capacities.addAll(_storageMgr.getStoragePoolUsedStats(hostId,podId,zoneId));
  }
  return capacities;
}

Fixed version (ground truth):
@Override public List<CapacityVO> listCapacities(ListCapacityCmd cmd){
  Integer capacityType=cmd.getType();
  Long zoneId=cmd.getZoneId();
  Long podId=cmd.getPodId();
  Long clusterId=cmd.getClusterId();
  zoneId=_accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(),zoneId);
  List<SummedCapacity> summedCapacities=_capacityDao.findCapacityBy(capacityType,zoneId,podId,clusterId);
  List<CapacityVO> capacities=new ArrayList<CapacityVO>();
  for (  SummedCapacity summedCapacity : summedCapacities) {
    CapacityVO capacity=new CapacityVO(null,zoneId,podId,clusterId,summedCapacity.getUsedCapacity(),summedCapacity.getTotalCapacity(),summedCapacity.getCapacityType());
    capacities.add(capacity);
  }
  if (capacityType == null || capacityType == Capacity.CAPACITY_TYPE_SECONDARY_STORAGE) {
    capacities.addAll(_storageMgr.getSecondaryStorageUsedStats(null,podId,zoneId));
  }
  if (capacityType == null || capacityType == Capacity.CAPACITY_TYPE_STORAGE) {
    capacities.addAll(_storageMgr.getStoragePoolUsedStats(null,podId,zoneId));
  }
  return capacities;
}
Program: 106680
Project: 106680
Buggy source:
@Override @DB public boolean destroySnapshotBackUp(long snapshotId){
  boolean success=false;
  String details;
  SnapshotVO snapshot=_snapshotDao.findByIdIncludingRemoved(snapshotId);
  if (snapshot == null) {
    throw new CloudRuntimeException("String_Node_Str" + snapshotId + "String_Node_Str");
  }
  String secondaryStoragePoolUrl=getSecondaryStorageURL(snapshot);
  Long dcId=snapshot.getDataCenterId();
  Long accountId=snapshot.getAccountId();
  Long volumeId=snapshot.getVolumeId();
  HypervisorType hvType=snapshot.getHypervisorType();
  String backupOfSnapshot=snapshot.getBackupSnapshotId();
  if (backupOfSnapshot == null) {
    return true;
  }
  SwiftTO swift=getSwiftTO(null);
  DeleteSnapshotBackupCommand cmd=new DeleteSnapshotBackupCommand(swift,secondaryStoragePoolUrl,dcId,accountId,volumeId,backupOfSnapshot,false);
  Answer answer=_agentMgr.sendToSSVM(dcId,cmd);
  if ((answer != null) && answer.getResult()) {
    snapshot.setBackupSnapshotId(null);
    _snapshotDao.update(snapshotId,snapshot);
    success=true;
    details="String_Node_Str" + snapshotId + "String_Node_Str"+ volumeId;
    s_logger.debug(details);
  }
 else   if (answer != null) {
    details="String_Node_Str" + snapshotId + "String_Node_Str"+ volumeId+ "String_Node_Str";
    if (answer.getDetails() != null) {
      details+=answer.getDetails();
    }
    s_logger.error(details);
  }
  return success;
}

Fixed version (ground truth):
@Override @DB public boolean destroySnapshotBackUp(long snapshotId){
  boolean success=false;
  String details;
  SnapshotVO snapshot=_snapshotDao.findByIdIncludingRemoved(snapshotId);
  if (snapshot == null) {
    throw new CloudRuntimeException("String_Node_Str" + snapshotId + "String_Node_Str");
  }
  String secondaryStoragePoolUrl=getSecondaryStorageURL(snapshot);
  Long dcId=snapshot.getDataCenterId();
  Long accountId=snapshot.getAccountId();
  Long volumeId=snapshot.getVolumeId();
  HypervisorType hvType=snapshot.getHypervisorType();
  String backupOfSnapshot=snapshot.getBackupSnapshotId();
  if (backupOfSnapshot == null) {
    return true;
  }
  SwiftTO swift=_swiftDao.getSwiftTO(null);
  DeleteSnapshotBackupCommand cmd=new DeleteSnapshotBackupCommand(swift,secondaryStoragePoolUrl,dcId,accountId,volumeId,backupOfSnapshot,false);
  Answer answer=_agentMgr.sendToSSVM(dcId,cmd);
  if ((answer != null) && answer.getResult()) {
    snapshot.setBackupSnapshotId(null);
    _snapshotDao.update(snapshotId,snapshot);
    success=true;
    details="String_Node_Str" + snapshotId + "String_Node_Str"+ volumeId;
    s_logger.debug(details);
  }
 else   if (answer != null) {
    details="String_Node_Str" + snapshotId + "String_Node_Str"+ volumeId+ "String_Node_Str";
    if (answer.getDetails() != null) {
      details+=answer.getDetails();
    }
    s_logger.error(details);
  }
  return success;
}
Program: 106681
Project: 106681
Buggy source:
String downloadTemplateFromSwiftToSecondaryStorage(long dcId,long templateId){
  VMTemplateVO template=_tmpltDao.findById(templateId);
  if (template == null) {
    String errMsg="String_Node_Str" + templateId;
    s_logger.warn(errMsg);
    return errMsg;
  }
  VMTemplateSwiftVO tmpltSwift=_tmpltSwiftDao.findOneByTemplateId(templateId);
  if (tmpltSwift == null) {
    String errMsg="String_Node_Str" + templateId + "String_Node_Str";
    s_logger.warn(errMsg);
    return errMsg;
  }
  SwiftTO swift=_snapshotMgr.getSwiftTO(tmpltSwift.getSwiftId());
  if (swift == null) {
    String errMsg="String_Node_Str" + tmpltSwift.getSwiftId() + "String_Node_Str";
    s_logger.warn(errMsg);
    return errMsg;
  }
  HostVO secHost=_hostDao.findSecondaryStorageHost(dcId);
  if (secHost == null) {
    String errMsg="String_Node_Str" + dcId;
    s_logger.warn(errMsg);
    return errMsg;
  }
  downloadTemplateFromSwiftToSecondaryStorageCommand cmd=new downloadTemplateFromSwiftToSecondaryStorageCommand(swift,secHost.getName(),dcId,template.getAccountId(),templateId,_primaryStorageDownloadWait);
  try {
    _agentMgr.sendToSSVM(dcId,cmd);
  }
 catch (  Exception e) {
    String errMsg="String_Node_Str" + e.toString();
    s_logger.warn(errMsg);
    throw new CloudRuntimeException(errMsg);
  }
  return null;
}

Fixed version (ground truth):
String downloadTemplateFromSwiftToSecondaryStorage(long dcId,long templateId){
  VMTemplateVO template=_tmpltDao.findById(templateId);
  if (template == null) {
    String errMsg="String_Node_Str" + templateId;
    s_logger.warn(errMsg);
    return errMsg;
  }
  VMTemplateSwiftVO tmpltSwift=_tmpltSwiftDao.findOneByTemplateId(templateId);
  if (tmpltSwift == null) {
    String errMsg="String_Node_Str" + templateId + "String_Node_Str";
    s_logger.warn(errMsg);
    return errMsg;
  }
  SwiftTO swift=_swiftDao.getSwiftTO(tmpltSwift.getSwiftId());
  if (swift == null) {
    String errMsg="String_Node_Str" + tmpltSwift.getSwiftId() + "String_Node_Str";
    s_logger.warn(errMsg);
    return errMsg;
  }
  HostVO secHost=_hostDao.findSecondaryStorageHost(dcId);
  if (secHost == null) {
    String errMsg="String_Node_Str" + dcId;
    s_logger.warn(errMsg);
    return errMsg;
  }
  downloadTemplateFromSwiftToSecondaryStorageCommand cmd=new downloadTemplateFromSwiftToSecondaryStorageCommand(swift,secHost.getName(),dcId,template.getAccountId(),templateId,_primaryStorageDownloadWait);
  try {
    _agentMgr.sendToSSVM(dcId,cmd);
  }
 catch (  Exception e) {
    String errMsg="String_Node_Str" + e.toString();
    s_logger.warn(errMsg);
    throw new CloudRuntimeException(errMsg);
  }
  return null;
}
Program: 106683
Project: 106683
Buggy source:
void swiftTemplateSync(){
  GlobalLock swiftTemplateSyncLock=GlobalLock.getInternLock("String_Node_Str");
  try {
    if (swiftTemplateSyncLock.lock(3)) {
      try {
        List<VMTemplateHostVO> templtHostRefs=_tmpltHostDao.listByState(VMTemplateHostVO.Status.DOWNLOADED);
        List<VMTemplateSwiftVO> templtSwiftRefs=_tmpltSwiftDao.listAll();
        for (        VMTemplateHostVO templtHostRef : templtHostRefs) {
          boolean found=false;
          for (          VMTemplateSwiftVO templtSwiftRef : templtSwiftRefs) {
            if (templtHostRef.getTemplateId() == templtSwiftRef.getTemplateId()) {
              found=true;
              break;
            }
          }
          if (!found) {
            try {
              uploadTemplateToSwiftFromSecondaryStorage(templtHostRef);
            }
 catch (            Exception e) {
              s_logger.debug("String_Node_Str" + templtHostRef.getTemplateId() + "String_Node_Str"+ e.toString());
            }
          }
        }
      }
 catch (      Throwable e) {
        s_logger.error("String_Node_Str" + e.toString(),e);
      }
 finally {
        swiftTemplateSyncLock.unlock();
      }
    }
  }
  finally {
    swiftTemplateSyncLock.releaseRef();
  }
}

Fixed version (ground truth):
void swiftTemplateSync(){
  Boolean swiftEnable=Boolean.valueOf(_configDao.getValue(Config.SwiftEnable.key()));
  if (!swiftEnable) {
    return;
  }
  GlobalLock swiftTemplateSyncLock=GlobalLock.getInternLock("String_Node_Str");
  try {
    if (swiftTemplateSyncLock.lock(3)) {
      try {
        List<VMTemplateHostVO> templtHostRefs=_tmpltHostDao.listByState(VMTemplateHostVO.Status.DOWNLOADED);
        List<VMTemplateSwiftVO> templtSwiftRefs=_tmpltSwiftDao.listAll();
        for (        VMTemplateHostVO templtHostRef : templtHostRefs) {
          boolean found=false;
          for (          VMTemplateSwiftVO templtSwiftRef : templtSwiftRefs) {
            if (templtHostRef.getTemplateId() == templtSwiftRef.getTemplateId()) {
              found=true;
              break;
            }
          }
          if (!found) {
            try {
              uploadTemplateToSwiftFromSecondaryStorage(templtHostRef);
            }
 catch (            Exception e) {
              s_logger.debug("String_Node_Str" + templtHostRef.getTemplateId() + "String_Node_Str"+ e.toString());
            }
          }
        }
      }
 catch (      Throwable e) {
        s_logger.error("String_Node_Str" + e.toString(),e);
      }
 finally {
        swiftTemplateSyncLock.unlock();
      }
    }
  }
  finally {
    swiftTemplateSyncLock.releaseRef();
  }
}
Program: 106684
Project: 106684
Buggy source:
@Override public boolean start(){
  _swiftTemplateSyncExecutor.scheduleAtFixedRate(getSwiftTemplateSyncTask(),120,300,TimeUnit.SECONDS);
  return true;
}

Fixed version (ground truth):
@Override public boolean start(){
  _swiftTemplateSyncExecutor.scheduleAtFixedRate(getSwiftTemplateSyncTask(),60,60,TimeUnit.SECONDS);
  return true;
}
Program: 106687
Project: 106687
Buggy source:
private List<NetworkVO> listAccountSpecificAndZoneLevelNetworks(SearchCriteria<NetworkVO> sc,Filter searchFilter,String path,List<Long> permittedAccounts){
  SearchCriteria<NetworkVO> ssc=_networksDao.createSearchCriteria();
  SearchCriteria<NetworkVO> accountSC=_networksDao.createSearchCriteria();
  if (!permittedAccounts.isEmpty()) {
    accountSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,permittedAccounts);
  }
  accountSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,false);
  if (path != null) {
    Set<Long> allowedDomains=_domainMgr.getDomainChildrenIds(path);
    accountSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,allowedDomains.toArray());
  }
  ssc.addOr("String_Node_Str",SearchCriteria.Op.SC,accountSC);
  SearchCriteria<NetworkVO> zoneSC=_networksDao.createSearchCriteria();
  zoneSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,false);
  zoneSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,true);
  ssc.addOr("String_Node_Str",SearchCriteria.Op.SC,zoneSC);
  sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,ssc);
  return _networksDao.search(sc,searchFilter);
}

Fixed version (ground truth):
private List<NetworkVO> listAccountSpecificAndZoneLevelNetworks(SearchCriteria<NetworkVO> sc,Filter searchFilter,String path,List<Long> permittedAccounts){
  SearchCriteria<NetworkVO> ssc=_networksDao.createSearchCriteria();
  SearchCriteria<NetworkVO> accountSC=_networksDao.createSearchCriteria();
  if (!permittedAccounts.isEmpty()) {
    accountSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,permittedAccounts.toArray());
  }
  accountSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,false);
  if (path != null) {
    Set<Long> allowedDomains=_domainMgr.getDomainChildrenIds(path);
    accountSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,allowedDomains.toArray());
  }
  ssc.addOr("String_Node_Str",SearchCriteria.Op.SC,accountSC);
  SearchCriteria<NetworkVO> zoneSC=_networksDao.createSearchCriteria();
  zoneSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,false);
  zoneSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,true);
  ssc.addOr("String_Node_Str",SearchCriteria.Op.SC,zoneSC);
  sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,ssc);
  return _networksDao.search(sc,searchFilter);
}
Program: 106688
Project: 106688
Buggy source:
private List<NetworkVO> listAccountSpecificAndZoneLevelNetworks(SearchCriteria<NetworkVO> sc,Filter searchFilter,String path,List<Long> permittedAccounts){
  SearchCriteria<NetworkVO> ssc=_networksDao.createSearchCriteria();
  SearchCriteria<NetworkVO> accountSC=_networksDao.createSearchCriteria();
  if (!permittedAccounts.isEmpty()) {
    accountSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,permittedAccounts);
  }
  accountSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,false);
  if (path != null) {
    Set<Long> allowedDomains=_domainMgr.getDomainChildrenIds(path);
    accountSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,allowedDomains.toArray());
  }
  ssc.addOr("String_Node_Str",SearchCriteria.Op.SC,accountSC);
  SearchCriteria<NetworkVO> zoneSC=_networksDao.createSearchCriteria();
  zoneSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,false);
  zoneSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,true);
  ssc.addOr("String_Node_Str",SearchCriteria.Op.SC,zoneSC);
  sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,ssc);
  return _networksDao.search(sc,searchFilter);
}

Fixed version (ground truth):
private List<NetworkVO> listAccountSpecificAndZoneLevelNetworks(SearchCriteria<NetworkVO> sc,Filter searchFilter,String path,List<Long> permittedAccounts){
  SearchCriteria<NetworkVO> ssc=_networksDao.createSearchCriteria();
  SearchCriteria<NetworkVO> accountSC=_networksDao.createSearchCriteria();
  if (!permittedAccounts.isEmpty()) {
    accountSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,permittedAccounts.toArray());
  }
  accountSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,false);
  if (path != null) {
    Set<Long> allowedDomains=_domainMgr.getDomainChildrenIds(path);
    accountSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,allowedDomains.toArray());
  }
  ssc.addOr("String_Node_Str",SearchCriteria.Op.SC,accountSC);
  SearchCriteria<NetworkVO> zoneSC=_networksDao.createSearchCriteria();
  zoneSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,false);
  zoneSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,true);
  ssc.addOr("String_Node_Str",SearchCriteria.Op.SC,zoneSC);
  sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,ssc);
  return _networksDao.search(sc,searchFilter);
}
Program: 106689
Project: 106689
Buggy source:
@Override public void performDataMigration(Connection conn){
}

Fixed version (ground truth):
@Override public void performDataMigration(Connection conn){
  fixForeignKeys(conn);
}
Program: 106690
Project: 106690
Buggy source:
public UserVmData newUserVmData(UserVm userVm){
  UserVmData userVmData=new UserVmData();
  userVmData.setId(userVm.getId());
  userVmData.setName(userVm.getInstanceName());
  userVmData.setCreated(userVm.getCreated());
  userVmData.setGuestOsId(userVm.getGuestOSId());
  userVmData.setHaEnable(userVm.isHaEnabled());
  if (userVm.getState() != null) {
    userVmData.setState(userVm.getState().toString());
  }
  if (userVm.getDisplayName() != null) {
    userVmData.setDisplayName(userVm.getDisplayName());
  }
 else {
    userVmData.setDisplayName(userVm.getHostName());
  }
  userVmData.setDomainId(userVm.getDomainId());
  if (userVm.getHypervisorType() != null) {
    userVmData.setHypervisor(userVm.getHypervisorType().toString());
  }
  if (userVm.getPassword() != null) {
    userVmData.setPassword(userVm.getPassword());
  }
  return userVmData;
}

Fixed version (ground truth):
public UserVmData newUserVmData(UserVm userVm){
  UserVmData userVmData=new UserVmData();
  userVmData.setId(userVm.getId());
  userVmData.setName(userVm.getHostName());
  userVmData.setCreated(userVm.getCreated());
  userVmData.setGuestOsId(userVm.getGuestOSId());
  userVmData.setHaEnable(userVm.isHaEnabled());
  if (userVm.getState() != null) {
    userVmData.setState(userVm.getState().toString());
  }
  if (userVm.getDisplayName() != null) {
    userVmData.setDisplayName(userVm.getDisplayName());
  }
 else {
    userVmData.setDisplayName(userVm.getHostName());
  }
  userVmData.setDomainId(userVm.getDomainId());
  if (userVm.getHypervisorType() != null) {
    userVmData.setHypervisor(userVm.getHypervisorType().toString());
  }
  if (userVm.getPassword() != null) {
    userVmData.setPassword(userVm.getPassword());
  }
  return userVmData;
}
Program: 106694
Project: 106694
Buggy source:
@Override public NicProfile allocate(Network network,NicProfile nic,VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
  DataCenter dc=_dcDao.findById(network.getDataCenterId());
  NetworkOffering offering=_networkOfferingDao.findByIdIncludingRemoved(network.getNetworkOfferingId());
  if (!canHandle(offering,dc)) {
    return null;
  }
  if (nic != null && nic.getRequestedIp() != null) {
    throw new CloudRuntimeException("String_Node_Str" + nic);
  }
  if (nic == null) {
    nic=new NicProfile(ReservationStrategy.Create,null,null,null,null);
  }
  getIp(nic,dc,vm,network);
  if (nic.getIp4Address() == null) {
    nic.setStrategy(ReservationStrategy.Start);
  }
 else {
    nic.setStrategy(ReservationStrategy.Managed);
  }
  return nic;
}

Fixed version (ground truth):
@Override public NicProfile allocate(Network network,NicProfile nic,VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
  DataCenter dc=_dcDao.findById(network.getDataCenterId());
  NetworkOffering offering=_networkOfferingDao.findByIdIncludingRemoved(network.getNetworkOfferingId());
  if (!canHandle(offering,dc)) {
    return null;
  }
  if (nic != null && nic.getRequestedIp() != null) {
    throw new CloudRuntimeException("String_Node_Str" + nic);
  }
  if (nic == null) {
    nic=new NicProfile(ReservationStrategy.Create,null,null,null,null);
  }
  getIp(nic,dc,vm,network);
  if (nic.getIp4Address() == null) {
    nic.setStrategy(ReservationStrategy.Start);
  }
 else   if (vm.getVirtualMachine().getType() == VirtualMachine.Type.DomainRouter) {
    nic.setStrategy(ReservationStrategy.Managed);
  }
 else {
    nic.setStrategy(ReservationStrategy.Create);
  }
  return nic;
}
Program: 106695
Project: 106695
Buggy source:
@Override public void execute(){
  List<? extends ResourceLimit> result=_accountService.searchForLimits(this);
  ListResponse<ResourceLimitResponse> response=new ListResponse<ResourceLimitResponse>();
  List<ResourceLimitResponse> limitResponses=new ArrayList<ResourceLimitResponse>();
  for (  ResourceLimit limit : result) {
    ResourceLimitResponse resourceLimitResponse=_responseGenerator.createResourceLimitResponse(limit);
    resourceLimitResponse.setObjectName("String_Node_Str");
    limitResponses.add(resourceLimitResponse);
  }
  response.setResponses(limitResponses);
  response.setResponseName(getCommandName());
  this.setResponseObject(response);
}

Fixed version (ground truth):
@Override public void execute(){
  List<? extends ResourceLimit> result=_accountService.searchForLimits(id,accountName,domainId,resourceType,this.getStartIndex(),this.getPageSizeVal());
  ListResponse<ResourceLimitResponse> response=new ListResponse<ResourceLimitResponse>();
  List<ResourceLimitResponse> limitResponses=new ArrayList<ResourceLimitResponse>();
  for (  ResourceLimit limit : result) {
    ResourceLimitResponse resourceLimitResponse=_responseGenerator.createResourceLimitResponse(limit);
    resourceLimitResponse.setObjectName("String_Node_Str");
    limitResponses.add(resourceLimitResponse);
  }
  response.setResponses(limitResponses);
  response.setResponseName(getCommandName());
  this.setResponseObject(response);
}
Program: 106696
Project: 106696
Buggy source:
@Override public void execute(){
  ResourceLimit result=_accountService.updateResourceLimit(this);
  if (result != null || (result == null && max != null && max.longValue() == -1L)) {
    ResourceLimitResponse response=_responseGenerator.createResourceLimitResponse(result);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
  }
 else {
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void execute(){
  ResourceLimit result=_accountService.updateResourceLimit(accountName,domainId,resourceType,max);
  if (result != null || (result == null && max != null && max.longValue() == -1L)) {
    ResourceLimitResponse response=_responseGenerator.createResourceLimitResponse(result);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
  }
 else {
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str");
  }
}
Program: 106697
Project: 106697
Buggy source:
/** 
 * Search for resource limits for the given id and/or account and/or type and/or domain.
 * @param cmd the command wrapping the id, type, account, and domain
 * @return a list of limits that match the criteria
 */
List<? extends ResourceLimit> searchForLimits(ListResourceLimitsCmd cmd);

Fixed version (ground truth):
/** 
 * Search for resource limits for the given id and/or account and/or type and/or domain.
 * @param id TODO
 * @param accountName TODO
 * @param domainId TODO
 * @param type TODO
 * @param startIndex TODO
 * @param pageSizeVal TODO
 * @return a list of limits that match the criteria
 */
List<? extends ResourceLimit> searchForLimits(Long id,String accountName,Long domainId,Integer type,Long startIndex,Long pageSizeVal);
Program: 106698
Project: 106698
Buggy source:
/** 
 * Updates an existing resource limit with the specified details. If a limit doesn't exist, will create one.
 * @param cmd the command that wraps the domainId, accountId, type, and max parameters
 * @return the updated/created resource limit
 */
ResourceLimit updateResourceLimit(UpdateResourceLimitCmd cmd);

Fixed version (ground truth):
/** 
 * Updates an existing resource limit with the specified details. If a limit doesn't exist, will create one.
 * @param accountName TODO
 * @param domainId TODO
 * @param typeId TODO
 * @param max TODO
 * @return the updated/created resource limit
 */
ResourceLimit updateResourceLimit(String accountName,Long domainId,int typeId,Long max);
Program: 106704
Project: 106704
Buggy source:
private boolean powerOffNoCheck() throws Exception {
  ManagedObjectReference morTask=_context.getService().powerOffVM_Task(_mor);
  String result=_context.getServiceUtil().waitForTask(morTask);
  if (result.equals("String_Node_Str")) {
    _context.waitForTaskProgressDone(morTask);
    return true;
  }
 else {
    s_logger.error("String_Node_Str" + TaskMO.getTaskFailureInfo(_context,morTask));
  }
  return false;
}

Fixed version (ground truth):
private boolean powerOffNoCheck() throws Exception {
  ManagedObjectReference morTask=_context.getService().powerOffVM_Task(_mor);
  String result=_context.getServiceUtil().waitForTask(morTask);
  if (result.equals("String_Node_Str")) {
    _context.waitForTaskProgressDone(morTask);
    long startTick=System.currentTimeMillis();
    while (getPowerState() != VirtualMachinePowerState.poweredOff && System.currentTimeMillis() - startTick < 5000) {
      try {
        Thread.sleep(1000);
      }
 catch (      InterruptedException e) {
      }
    }
    return true;
  }
 else {
    if (getPowerState() == VirtualMachinePowerState.poweredOff) {
      s_logger.info("String_Node_Str");
      return true;
    }
    s_logger.error("String_Node_Str" + TaskMO.getTaskFailureInfo(_context,morTask));
  }
  return false;
}
Program: 106706
Project: 106706
Buggy source:
public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo,int controllerKey,String vmdkDatastorePathChain[],ManagedObjectReference morDs,int deviceNumber,int contextNumber) throws Exception {
  assert(vmdkDatastorePathChain != null);
  assert(vmdkDatastorePathChain.length >= 1);
  if (controllerKey < 0)   controllerKey=vmMo.getIDEDeviceControllerKey();
  VirtualDisk disk=new VirtualDisk();
  VirtualDiskFlatVer2BackingInfo backingInfo=new VirtualDiskFlatVer2BackingInfo();
  backingInfo.setDatastore(morDs);
  backingInfo.setFileName(vmdkDatastorePathChain[0]);
  backingInfo.setDiskMode(VirtualDiskMode.persistent.toString());
  if (vmdkDatastorePathChain.length > 1) {
    String[] parentDisks=new String[vmdkDatastorePathChain.length - 1];
    for (int i=0; i < vmdkDatastorePathChain.length - 1; i++)     parentDisks[i]=vmdkDatastorePathChain[i + 1];
    setParentBackingInfo(backingInfo,morDs,parentDisks);
  }
  disk.setBacking(backingInfo);
  if (deviceNumber < 0)   deviceNumber=vmMo.getNextDeviceNumber(controllerKey);
  disk.setControllerKey(controllerKey);
  disk.setKey(-contextNumber);
  disk.setUnitNumber(deviceNumber);
  VirtualDeviceConnectInfo connectInfo=new VirtualDeviceConnectInfo();
  connectInfo.setConnected(true);
  connectInfo.setStartConnected(true);
  disk.setConnectable(connectInfo);
  return disk;
}

Fixed version (ground truth):
public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo,int controllerKey,String vmdkDatastorePathChain[],ManagedObjectReference morDs,int deviceNumber,int contextNumber) throws Exception {
  assert(vmdkDatastorePathChain != null);
  assert(vmdkDatastorePathChain.length >= 1);
  VirtualDisk disk=new VirtualDisk();
  VirtualDiskFlatVer2BackingInfo backingInfo=new VirtualDiskFlatVer2BackingInfo();
  backingInfo.setDatastore(morDs);
  backingInfo.setFileName(vmdkDatastorePathChain[0]);
  backingInfo.setDiskMode(VirtualDiskMode.persistent.toString());
  if (vmdkDatastorePathChain.length > 1) {
    String[] parentDisks=new String[vmdkDatastorePathChain.length - 1];
    for (int i=0; i < vmdkDatastorePathChain.length - 1; i++)     parentDisks[i]=vmdkDatastorePathChain[i + 1];
    setParentBackingInfo(backingInfo,morDs,parentDisks);
  }
  disk.setBacking(backingInfo);
  if (controllerKey < 0)   controllerKey=vmMo.getIDEDeviceControllerKey();
  if (deviceNumber < 0)   deviceNumber=vmMo.getNextDeviceNumber(controllerKey);
  disk.setControllerKey(controllerKey);
  disk.setKey(-contextNumber);
  disk.setUnitNumber(deviceNumber);
  VirtualDeviceConnectInfo connectInfo=new VirtualDeviceConnectInfo();
  connectInfo.setConnected(true);
  connectInfo.setStartConnected(true);
  disk.setConnectable(connectInfo);
  return disk;
}
Program: 106707
Project: 106707
Buggy source:
public static VirtualDevice prepareNicDevice(VirtualMachineMO vmMo,ManagedObjectReference morNetwork,VirtualEthernetCardType deviceType,String portGroupName,String macAddress,int deviceNumber,int contextNumber,boolean conntected,boolean connectOnStart) throws Exception {
  VirtualEthernetCard nic;
switch (deviceType) {
case E1000:
    nic=new VirtualE1000();
  break;
case PCNet32:
nic=new VirtualPCNet32();
break;
case Vmxnet2:
nic=new VirtualVmxnet2();
break;
case Vmxnet3:
nic=new VirtualVmxnet3();
break;
default :
assert(false);
nic=new VirtualE1000();
}
VirtualEthernetCardNetworkBackingInfo nicBacking=new VirtualEthernetCardNetworkBackingInfo();
nicBacking.setDeviceName(portGroupName);
nicBacking.setNetwork(morNetwork);
nic.setBacking(nicBacking);
VirtualDeviceConnectInfo connectInfo=new VirtualDeviceConnectInfo();
connectInfo.setAllowGuestControl(true);
connectInfo.setConnected(conntected);
connectInfo.setStartConnected(connectOnStart);
nic.setAddressType("String_Node_Str");
nic.setConnectable(connectInfo);
nic.setMacAddress(macAddress);
nic.setControllerKey(vmMo.getPCIDeviceControllerKey());
if (deviceNumber < 0) deviceNumber=vmMo.getNextPCIDeviceNumber();
nic.setUnitNumber(deviceNumber);
nic.setKey(-contextNumber);
return nic;
}

Fixed version (ground truth):
public static VirtualDevice prepareNicDevice(VirtualMachineMO vmMo,ManagedObjectReference morNetwork,VirtualEthernetCardType deviceType,String portGroupName,String macAddress,int deviceNumber,int contextNumber,boolean conntected,boolean connectOnStart) throws Exception {
  VirtualEthernetCard nic;
switch (deviceType) {
case E1000:
    nic=new VirtualE1000();
  break;
case PCNet32:
nic=new VirtualPCNet32();
break;
case Vmxnet2:
nic=new VirtualVmxnet2();
break;
case Vmxnet3:
nic=new VirtualVmxnet3();
break;
default :
assert(false);
nic=new VirtualE1000();
}
VirtualEthernetCardNetworkBackingInfo nicBacking=new VirtualEthernetCardNetworkBackingInfo();
nicBacking.setDeviceName(portGroupName);
nicBacking.setNetwork(morNetwork);
nic.setBacking(nicBacking);
VirtualDeviceConnectInfo connectInfo=new VirtualDeviceConnectInfo();
connectInfo.setAllowGuestControl(true);
connectInfo.setConnected(conntected);
connectInfo.setStartConnected(connectOnStart);
nic.setAddressType("String_Node_Str");
nic.setConnectable(connectInfo);
nic.setMacAddress(macAddress);
nic.setUnitNumber(deviceNumber);
nic.setKey(-contextNumber);
return nic;
}
Program: 106708
Project: 106708
Buggy source:
@Override public void onManagementNodeLeft(List<ManagementServerHostVO> nodeList,long selfNodeId){
  for (  ManagementServerHostVO msHost : nodeList) {
    Transaction txn=Transaction.open(Transaction.CLOUD_DB);
    try {
      txn.start();
      List<SyncQueueItemVO> items=_queueMgr.getActiveQueueItems(msHost.getId(),true);
      cleanupPendingJobs(items);
      _queueMgr.resetQueueProcess(msHost.getId());
      _jobDao.resetJobProcess(msHost.getId(),BaseCmd.INTERNAL_ERROR,getResetResultMessage("String_Node_Str"));
      txn.commit();
    }
 catch (    Throwable e) {
      s_logger.warn("String_Node_Str",e);
      txn.rollback();
    }
 finally {
      txn.close();
    }
  }
}

Fixed version (ground truth):
@Override public void onManagementNodeLeft(List<ManagementServerHostVO> nodeList,long selfNodeId){
  for (  ManagementServerHostVO msHost : nodeList) {
    Transaction txn=Transaction.open(Transaction.CLOUD_DB);
    try {
      txn.start();
      List<SyncQueueItemVO> items=_queueMgr.getActiveQueueItems(msHost.getId(),true);
      cleanupPendingJobs(items);
      _queueMgr.resetQueueProcess(msHost.getId());
      _jobDao.resetJobProcess(msHost.getId(),BaseCmd.INTERNAL_ERROR,getSerializedErrorMessage("String_Node_Str"));
      txn.commit();
    }
 catch (    Throwable e) {
      s_logger.warn("String_Node_Str",e);
      txn.rollback();
    }
 finally {
      txn.close();
    }
  }
}
Program: 106709
Project: 106709
Buggy source:
private void reallyRun(){
  try {
    s_logger.trace("String_Node_Str");
    Date cutTime=new Date(DateUtil.currentGMTTime().getTime() - _jobExpireSeconds * 1000);
    List<AsyncJobVO> l=_jobDao.getExpiredJobs(cutTime,100);
    if (l != null && l.size() > 0) {
      for (      AsyncJobVO job : l) {
        _jobDao.expunge(job.getId());
      }
    }
    List<SyncQueueItemVO> blockItems=_queueMgr.getBlockedQueueItems(_jobCancelThresholdSeconds * 1000,false);
    if (blockItems != null && blockItems.size() > 0) {
      for (      SyncQueueItemVO item : blockItems) {
        if (item.getContentType().equalsIgnoreCase("String_Node_Str")) {
          completeAsyncJob(item.getContentId(),2,0,getResetResultMessage("String_Node_Str"));
        }
        _queueMgr.purgeItem(item.getId());
      }
    }
    s_logger.trace("String_Node_Str");
  }
 catch (  Throwable e) {
    s_logger.error("String_Node_Str",e);
  }
 finally {
    StackMaid.current().exitCleanup();
  }
}

Fixed version (ground truth):
private void reallyRun(){
  try {
    s_logger.trace("String_Node_Str");
    Date cutTime=new Date(DateUtil.currentGMTTime().getTime() - _jobExpireSeconds * 1000);
    List<AsyncJobVO> l=_jobDao.getExpiredJobs(cutTime,100);
    if (l != null && l.size() > 0) {
      for (      AsyncJobVO job : l) {
        _jobDao.expunge(job.getId());
      }
    }
    List<SyncQueueItemVO> blockItems=_queueMgr.getBlockedQueueItems(_jobCancelThresholdSeconds * 1000,false);
    if (blockItems != null && blockItems.size() > 0) {
      for (      SyncQueueItemVO item : blockItems) {
        if (item.getContentType().equalsIgnoreCase("String_Node_Str")) {
          completeAsyncJob(item.getContentId(),2,0,getResetResultResponse("String_Node_Str"));
        }
        _queueMgr.purgeItem(item.getId());
      }
    }
    s_logger.trace("String_Node_Str");
  }
 catch (  Throwable e) {
    s_logger.error("String_Node_Str",e);
  }
 finally {
    StackMaid.current().exitCleanup();
  }
}
Program: 106710
Project: 106710
Buggy source:
private void cleanupPendingJobs(List<SyncQueueItemVO> l){
  if (l != null && l.size() > 0) {
    for (    SyncQueueItemVO item : l) {
      if (s_logger.isInfoEnabled()) {
        s_logger.info("String_Node_Str" + item.toString());
      }
      String contentType=item.getContentType();
      if (contentType != null && contentType.equals("String_Node_Str")) {
        Long jobId=item.getContentId();
        if (jobId != null) {
          s_logger.warn("String_Node_Str" + jobId);
          completeAsyncJob(jobId,AsyncJobResult.STATUS_FAILED,0,getResetResultMessage("String_Node_Str"));
        }
      }
      _queueMgr.purgeItem(item.getId());
    }
  }
}

Fixed version (ground truth):
private void cleanupPendingJobs(List<SyncQueueItemVO> l){
  if (l != null && l.size() > 0) {
    for (    SyncQueueItemVO item : l) {
      if (s_logger.isInfoEnabled()) {
        s_logger.info("String_Node_Str" + item.toString());
      }
      String contentType=item.getContentType();
      if (contentType != null && contentType.equals("String_Node_Str")) {
        Long jobId=item.getContentId();
        if (jobId != null) {
          s_logger.warn("String_Node_Str" + jobId);
          completeAsyncJob(jobId,AsyncJobResult.STATUS_FAILED,0,getResetResultResponse("String_Node_Str"));
        }
      }
      _queueMgr.purgeItem(item.getId());
    }
  }
}
Program: 106711
Project: 106711
Buggy source:
@DB private Runnable getGCTask(){
  return new Runnable(){
    @Override public void run(){
      GlobalLock scanLock=GlobalLock.getInternLock("String_Node_Str");
      try {
        if (scanLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION)) {
          try {
            reallyRun();
          }
  finally {
            scanLock.unlock();
          }
        }
      }
  finally {
        scanLock.releaseRef();
      }
    }
    private void reallyRun(){
      try {
        s_logger.trace("String_Node_Str");
        Date cutTime=new Date(DateUtil.currentGMTTime().getTime() - _jobExpireSeconds * 1000);
        List<AsyncJobVO> l=_jobDao.getExpiredJobs(cutTime,100);
        if (l != null && l.size() > 0) {
          for (          AsyncJobVO job : l) {
            _jobDao.expunge(job.getId());
          }
        }
        List<SyncQueueItemVO> blockItems=_queueMgr.getBlockedQueueItems(_jobCancelThresholdSeconds * 1000,false);
        if (blockItems != null && blockItems.size() > 0) {
          for (          SyncQueueItemVO item : blockItems) {
            if (item.getContentType().equalsIgnoreCase("String_Node_Str")) {
              completeAsyncJob(item.getContentId(),2,0,getResetResultMessage("String_Node_Str"));
            }
            _queueMgr.purgeItem(item.getId());
          }
        }
        s_logger.trace("String_Node_Str");
      }
 catch (      Throwable e) {
        s_logger.error("String_Node_Str",e);
      }
 finally {
        StackMaid.current().exitCleanup();
      }
    }
  }
;
}

Fixed version (ground truth):
@DB private Runnable getGCTask(){
  return new Runnable(){
    @Override public void run(){
      GlobalLock scanLock=GlobalLock.getInternLock("String_Node_Str");
      try {
        if (scanLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION)) {
          try {
            reallyRun();
          }
  finally {
            scanLock.unlock();
          }
        }
      }
  finally {
        scanLock.releaseRef();
      }
    }
    private void reallyRun(){
      try {
        s_logger.trace("String_Node_Str");
        Date cutTime=new Date(DateUtil.currentGMTTime().getTime() - _jobExpireSeconds * 1000);
        List<AsyncJobVO> l=_jobDao.getExpiredJobs(cutTime,100);
        if (l != null && l.size() > 0) {
          for (          AsyncJobVO job : l) {
            _jobDao.expunge(job.getId());
          }
        }
        List<SyncQueueItemVO> blockItems=_queueMgr.getBlockedQueueItems(_jobCancelThresholdSeconds * 1000,false);
        if (blockItems != null && blockItems.size() > 0) {
          for (          SyncQueueItemVO item : blockItems) {
            if (item.getContentType().equalsIgnoreCase("String_Node_Str")) {
              completeAsyncJob(item.getContentId(),2,0,getResetResultResponse("String_Node_Str"));
            }
            _queueMgr.purgeItem(item.getId());
          }
        }
        s_logger.trace("String_Node_Str");
      }
 catch (      Throwable e) {
        s_logger.error("String_Node_Str",e);
      }
 finally {
        StackMaid.current().exitCleanup();
      }
    }
  }
;
}
Program: 106712
Project: 106712
Buggy source:
@Override public boolean start(){
  try {
    List<SyncQueueItemVO> l=_queueMgr.getActiveQueueItems(getMsid(),false);
    cleanupPendingJobs(l);
    _queueMgr.resetQueueProcess(getMsid());
    _jobDao.resetJobProcess(getMsid(),BaseCmd.INTERNAL_ERROR,getResetResultMessage("String_Node_Str"));
  }
 catch (  Throwable e) {
    s_logger.error("String_Node_Str" + e.getMessage(),e);
  }
  _heartbeatScheduler.scheduleAtFixedRate(getHeartbeatTask(),HEARTBEAT_INTERVAL,HEARTBEAT_INTERVAL,TimeUnit.MILLISECONDS);
  _heartbeatScheduler.scheduleAtFixedRate(getGCTask(),GC_INTERVAL,GC_INTERVAL,TimeUnit.MILLISECONDS);
  return true;
}

Fixed version (ground truth):
@Override public boolean start(){
  try {
    List<SyncQueueItemVO> l=_queueMgr.getActiveQueueItems(getMsid(),false);
    cleanupPendingJobs(l);
    _queueMgr.resetQueueProcess(getMsid());
    _jobDao.resetJobProcess(getMsid(),BaseCmd.INTERNAL_ERROR,getSerializedErrorMessage("String_Node_Str"));
  }
 catch (  Throwable e) {
    s_logger.error("String_Node_Str" + e.getMessage(),e);
  }
  _heartbeatScheduler.scheduleAtFixedRate(getHeartbeatTask(),HEARTBEAT_INTERVAL,HEARTBEAT_INTERVAL,TimeUnit.MILLISECONDS);
  _heartbeatScheduler.scheduleAtFixedRate(getGCTask(),GC_INTERVAL,GC_INTERVAL,TimeUnit.MILLISECONDS);
  return true;
}
Program: 106713
Project: 106713
Buggy source:
@Override public Integer getNetworkRate(long networkId,Long vmId){
  VMInstanceVO vm=null;
  if (vmId != null) {
    vm=_vmDao.findById(vmId);
  }
  Network network=getNetwork(networkId);
  NetworkOffering networkOffering=_configMgr.getNetworkOffering(network.getNetworkOfferingId());
  boolean isUserVmsDefaultNetwork=false;
  boolean isDomRGuestOrPublicNetwork=false;
  if (vm != null) {
    if (vm.getType() == Type.User && network.isDefault()) {
      isUserVmsDefaultNetwork=true;
    }
 else     if (vm.getType() == Type.DomainRouter && networkOffering.getTrafficType() == TrafficType.Public && networkOffering.getGuestType() == null) {
      isDomRGuestOrPublicNetwork=true;
    }
  }
  if (isUserVmsDefaultNetwork || isDomRGuestOrPublicNetwork) {
    return _configMgr.getServiceOfferingNetworkRate(vm.getServiceOfferingId());
  }
 else {
    return _configMgr.getNetworkOfferingNetworkRate(networkOffering.getId());
  }
}

Fixed version (ground truth):
@Override public Integer getNetworkRate(long networkId,Long vmId){
  VMInstanceVO vm=null;
  if (vmId != null) {
    vm=_vmDao.findById(vmId);
  }
  Network network=getNetwork(networkId);
  NetworkOffering ntwkOff=_configMgr.getNetworkOffering(network.getNetworkOfferingId());
  boolean isUserVmsDefaultNetwork=false;
  boolean isDomRGuestOrPublicNetwork=false;
  if (vm != null) {
    if (vm.getType() == Type.User && network.isDefault()) {
      isUserVmsDefaultNetwork=true;
    }
 else     if (vm.getType() == Type.DomainRouter && ((ntwkOff.getTrafficType() == TrafficType.Public && ntwkOff.getGuestType() == null) || (ntwkOff.getGuestType() != null && ntwkOff.getTrafficType() == TrafficType.Guest))) {
      isDomRGuestOrPublicNetwork=true;
    }
  }
  if (isUserVmsDefaultNetwork || isDomRGuestOrPublicNetwork) {
    return _configMgr.getServiceOfferingNetworkRate(vm.getServiceOfferingId());
  }
 else {
    return _configMgr.getNetworkOfferingNetworkRate(ntwkOff.getId());
  }
}
Program: 106721
Project: 106721
Buggy source:
private Merovingian2(long msId){
  super(MerovingianMBean.class,false);
  _msId=msId;
  Connection conn=null;
  try {
    conn=Transaction.getStandaloneConnectionWithException();
    conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    conn.setAutoCommit(true);
    _concierge=new ConnectionConcierge("String_Node_Str",conn,false);
  }
 catch (  SQLException e) {
    s_logger.error("String_Node_Str",e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private Merovingian2(long msId){
  super(MerovingianMBean.class,false);
  _msId=msId;
  Connection conn=null;
  try {
    conn=Transaction.getStandaloneConnectionWithException();
    conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    conn.setAutoCommit(true);
    _concierge=new ConnectionConcierge("String_Node_Str",conn,true);
  }
 catch (  SQLException e) {
    s_logger.error("String_Node_Str",e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}
Program: 106722
Project: 106722
Buggy source:
private Merovingian2(long msId){
  super(MerovingianMBean.class,false);
  _msId=msId;
  Connection conn=null;
  try {
    conn=Transaction.getStandaloneConnectionWithException();
    conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    conn.setAutoCommit(true);
    _concierge=new ConnectionConcierge("String_Node_Str",conn,false);
  }
 catch (  SQLException e) {
    s_logger.error("String_Node_Str",e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private Merovingian2(long msId){
  super(MerovingianMBean.class,false);
  _msId=msId;
  Connection conn=null;
  try {
    conn=Transaction.getStandaloneConnectionWithException();
    conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    conn.setAutoCommit(true);
    _concierge=new ConnectionConcierge("String_Node_Str",conn,true);
  }
 catch (  SQLException e) {
    s_logger.error("String_Node_Str",e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}
Program: 106723
Project: 106723
Buggy source:
private Merovingian2(long msId){
  super(MerovingianMBean.class,false);
  _msId=msId;
  Connection conn=null;
  try {
    conn=Transaction.getStandaloneConnectionWithException();
    conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    conn.setAutoCommit(true);
    _concierge=new ConnectionConcierge("String_Node_Str",conn,false);
  }
 catch (  SQLException e) {
    s_logger.error("String_Node_Str",e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private Merovingian2(long msId){
  super(MerovingianMBean.class,false);
  _msId=msId;
  Connection conn=null;
  try {
    conn=Transaction.getStandaloneConnectionWithException();
    conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    conn.setAutoCommit(true);
    _concierge=new ConnectionConcierge("String_Node_Str",conn,true);
  }
 catch (  SQLException e) {
    s_logger.error("String_Node_Str",e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}