nus-yam/ex-repair huggingface dataset:
Program: 107220
Project: 107220
Buggy source:
private String getDevLabel(int devId,diskBus bus){
  char suffix=(char)('a' + devId);
  if (bus == diskBus.SCSI) {
    return "String_Node_Str" + suffix;
  }
 else   if (bus == diskBus.VIRTIO) {
    return "String_Node_Str" + suffix;
  }
  return "String_Node_Str" + suffix;
}

Fixed version (ground truth):
private String getDevLabel(int devId,diskBus bus){
  if (devId >= 2) {
    devId++;
  }
  char suffix=(char)('a' + devId);
  if (bus == diskBus.SCSI) {
    return "String_Node_Str" + suffix;
  }
 else   if (bus == diskBus.VIRTIO) {
    return "String_Node_Str" + suffix;
  }
  return "String_Node_Str" + suffix;
}
Program: 107222
Project: 107222
Buggy source:
/** 
 * Creates a User VM in the database and returns the VM to the caller.
 * @param cmd Command to deploy.
 * @return UserVm object if successful.
 * @throws InsufficientCapacityException if there is insufficient capacity to deploy the VM.
 * @throws ConcurrentOperationException if there are multiple users working on the same VM or in the same environment.
 * @throws ResourceUnavailableException if the resources required to deploy the VM is not currently available.
 * @throws PermissionDeniedException if the caller doesn't have any access rights to the VM.
 * @throws InvalidParameterValueException if the parameters are incorrect. 
 */
UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException ;

Fixed version (ground truth):
/** 
 * Creates a User VM in the database and returns the VM to the caller.
 * @param cmd Command to deploy.
 * @return UserVm object if successful.
 * @throws InsufficientCapacityException if there is insufficient capacity to deploy the VM.
 * @throws ConcurrentOperationException if there are multiple users working on the same VM or in the same environment.
 * @throws ResourceUnavailableException if the resources required to deploy the VM is not currently available.
 * @throws InsufficientResourcesException 
 * @throws PermissionDeniedException if the caller doesn't have any access rights to the VM.
 * @throws InvalidParameterValueException if the parameters are incorrect. 
 */
UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException ;
Program: 107225
Project: 107225
Buggy source:
protected VDI getVDIbyUuid(Connection conn,String uuid){
  try {
    return VDI.getByUuid(conn,uuid);
  }
 catch (  XenAPIException e) {
    String msg="String_Node_Str" + uuid + "String_Node_Str"+ e.toString();
    s_logger.warn(msg,e);
    throw new CloudRuntimeException(msg,e);
  }
catch (  Exception e) {
    String msg="String_Node_Str" + uuid + "String_Node_Str"+ e.getMessage();
    s_logger.warn(msg,e);
    throw new CloudRuntimeException(msg,e);
  }
}

Fixed version (ground truth):
protected VDI getVDIbyUuid(Connection conn,String uuid){
  try {
    return VDI.getByUuid(conn,uuid);
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + e.getClass().getName() + "String_Node_Str"+ uuid+ "String_Node_Str"+ e.toString();
    s_logger.debug(msg);
    throw new CloudRuntimeException(msg,e);
  }
}
Program: 107226
Project: 107226
Buggy source:
@Override public boolean deleteVolume(DeleteVolumeCmd cmd) throws ConcurrentOperationException {
  Account account=UserContext.current().getCaller();
  Long volumeId=cmd.getId();
  boolean isAdmin;
  if (account == null) {
    isAdmin=true;
  }
 else {
    isAdmin=isAdmin(account.getType());
  }
  VolumeVO volume=_volsDao.findById(volumeId);
  if (volume == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId);
  }
  if (!isAdmin) {
    if (account.getId() != volume.getAccountId()) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str"+ account.getAccountName());
    }
  }
 else   if ((account != null) && !_domainDao.isChildDomain(account.getDomainId(),volume.getDomainId())) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str");
  }
  if (volume.getInstanceId() != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (volume.getState() != Volume.State.Destroy) {
    destroyVolume(volume);
  }
  expungeVolume(volume);
  return true;
}

Fixed version (ground truth):
@Override public boolean deleteVolume(DeleteVolumeCmd cmd) throws ConcurrentOperationException {
  Account account=UserContext.current().getCaller();
  Long volumeId=cmd.getId();
  boolean isAdmin;
  if (account == null) {
    isAdmin=true;
  }
 else {
    isAdmin=isAdmin(account.getType());
  }
  VolumeVO volume=_volsDao.findById(volumeId);
  if (volume == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId);
  }
  if (!isAdmin) {
    if (account.getId() != volume.getAccountId()) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str"+ account.getAccountName());
    }
  }
 else   if ((account != null) && !_domainDao.isChildDomain(account.getDomainId(),volume.getDomainId())) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str");
  }
  if (volume.getInstanceId() != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (volume.getState() != Volume.State.Destroy) {
    destroyVolume(volume);
  }
  try {
    expungeVolume(volume);
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str" + e);
    return false;
  }
  return true;
}
Program: 107228
Project: 107228
Buggy source:
public VolumeTO(Volume volume,StoragePool pool){
  this.id=volume.getId();
  this.name=volume.getName();
  this.path=volume.getPath();
  this.size=volume.getSize();
  this.type=volume.getVolumeType();
  this.resourceType=volume.getStorageResourceType();
  this.storagePoolType=pool.getPoolType();
  this.storagePoolUuid=pool.getUuid();
  this.mountPoint=volume.getFolder();
  this.chainInfo=volume.getChainInfo();
  this.deviceId=volume.getDeviceId();
}

Fixed version (ground truth):
public VolumeTO(Volume volume,StoragePool pool){
  this.id=volume.getId();
  this.name=volume.getName();
  this.path=volume.getPath();
  this.size=volume.getSize();
  this.type=volume.getVolumeType();
  this.resourceType=volume.getStorageResourceType();
  this.storagePoolType=pool.getPoolType();
  this.storagePoolUuid=pool.getUuid();
  this.mountPoint=volume.getFolder();
  this.chainInfo=volume.getChainInfo();
  if (volume.getDeviceId() != null)   this.deviceId=volume.getDeviceId();
}
Program: 107230
Project: 107230
Buggy source:
/** 
 * @return the type of IP address to allocate as the primary ip address to a guest
 */
NetworkOffering.GuestIpType getGuestIpType();

Fixed version (ground truth):
/** 
 * @return the type of IP address to allocate as the primary ip address to a guest
 */
Network.GuestIpType getGuestIpType();
Program: 107231
Project: 107231
Buggy source:
/** 
 * Creates a new network offering
 * @param name
 * @param displayText
 * @param type
 * @param trafficType
 * @param tags
 * @param maxConnections
 * @param id
 * @param specifyVlan;
 * @return network offering object
 */
NetworkOfferingVO createNetworkOffering(long userId,String name,String displayText,GuestIpType type,TrafficType trafficType,String tags,Integer maxConnections,boolean specifyVlan,Availability availability);

Fixed version (ground truth):
/** 
 * Creates a new network offering
 * @param name
 * @param displayText
 * @param trafficType
 * @param tags
 * @param maxConnections
 * @param id
 * @param specifyVlan;
 * @return network offering object
 */
NetworkOfferingVO createNetworkOffering(long userId,String name,String displayText,TrafficType trafficType,String tags,Integer maxConnections,boolean specifyVlan,Availability availability);
Program: 107232
Project: 107232
Buggy source:
@Override public NetworkOfferingVO createNetworkOffering(long userId,String name,String displayText,GuestIpType type,TrafficType trafficType,String tags,Integer maxConnections,boolean specifyVlan,Availability availability){
  String networkRateStr=_configDao.getValue("String_Node_Str");
  String multicastRateStr=_configDao.getValue("String_Node_Str");
  int networkRate=((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
  int multicastRate=((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
  tags=cleanupTags(tags);
  NetworkOfferingVO offering=new NetworkOfferingVO(name,displayText,trafficType,false,specifyVlan,networkRate,multicastRate,maxConnections,false,availability,false,false,false,false,false,false,false);
  if ((offering=_networkOfferingDao.persist(offering)) != null) {
    saveConfigurationEvent(userId,null,EventTypes.EVENT_NETWORK_OFFERING_CREATE,"String_Node_Str" + name + "String_Node_Str","String_Node_Str" + offering.getId(),"String_Node_Str" + name,"String_Node_Str" + displayText,"String_Node_Str" + tags);
    return offering;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public NetworkOfferingVO createNetworkOffering(long userId,String name,String displayText,TrafficType trafficType,String tags,Integer maxConnections,boolean specifyVlan,Availability availability){
  String networkRateStr=_configDao.getValue("String_Node_Str");
  String multicastRateStr=_configDao.getValue("String_Node_Str");
  int networkRate=((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
  int multicastRate=((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
  tags=cleanupTags(tags);
  NetworkOfferingVO offering=new NetworkOfferingVO(name,displayText,trafficType,false,specifyVlan,networkRate,multicastRate,maxConnections,false,availability,false,false,false,false,false,false,false);
  if ((offering=_networkOfferingDao.persist(offering)) != null) {
    saveConfigurationEvent(userId,null,EventTypes.EVENT_NETWORK_OFFERING_CREATE,"String_Node_Str" + name + "String_Node_Str","String_Node_Str" + offering.getId(),"String_Node_Str" + name,"String_Node_Str" + displayText,"String_Node_Str" + tags);
    return offering;
  }
 else {
    return null;
  }
}
Program: 107233
Project: 107233
Buggy source:
@Override public ServiceOfferingVO createServiceOffering(long userId,String name,int cpu,int ramSize,int speed,String displayText,boolean localStorageRequired,boolean offerHA,boolean useVirtualNetwork,String tags,Long domainId){
  String networkRateStr=_configDao.getValue("String_Node_Str");
  String multicastRateStr=_configDao.getValue("String_Node_Str");
  int networkRate=((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
  int multicastRate=((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
  NetworkOffering.GuestIpType guestIpType=useVirtualNetwork ? NetworkOffering.GuestIpType.Virtual : NetworkOffering.GuestIpType.Direct;
  tags=cleanupTags(tags);
  ServiceOfferingVO offering=new ServiceOfferingVO(name,cpu,ramSize,speed,networkRate,multicastRate,offerHA,displayText,guestIpType,localStorageRequired,false,tags,false,domainId);
  if ((offering=_serviceOfferingDao.persist(offering)) != null) {
    saveConfigurationEvent(userId,null,EventTypes.EVENT_SERVICE_OFFERING_CREATE,"String_Node_Str" + name + "String_Node_Str","String_Node_Str" + offering.getId(),"String_Node_Str" + name,"String_Node_Str" + cpu,"String_Node_Str" + ramSize,"String_Node_Str" + speed,"String_Node_Str" + displayText,"String_Node_Str" + guestIpType,"String_Node_Str" + localStorageRequired,"String_Node_Str" + offerHA,"String_Node_Str" + useVirtualNetwork,"String_Node_Str" + tags);
    return offering;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public ServiceOfferingVO createServiceOffering(long userId,String name,int cpu,int ramSize,int speed,String displayText,boolean localStorageRequired,boolean offerHA,boolean useVirtualNetwork,String tags,Long domainId){
  String networkRateStr=_configDao.getValue("String_Node_Str");
  String multicastRateStr=_configDao.getValue("String_Node_Str");
  int networkRate=((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
  int multicastRate=((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
  Network.GuestIpType guestIpType=useVirtualNetwork ? Network.GuestIpType.Virtual : Network.GuestIpType.Direct;
  tags=cleanupTags(tags);
  ServiceOfferingVO offering=new ServiceOfferingVO(name,cpu,ramSize,speed,networkRate,multicastRate,offerHA,displayText,guestIpType,localStorageRequired,false,tags,false,domainId);
  if ((offering=_serviceOfferingDao.persist(offering)) != null) {
    saveConfigurationEvent(userId,null,EventTypes.EVENT_SERVICE_OFFERING_CREATE,"String_Node_Str" + name + "String_Node_Str","String_Node_Str" + offering.getId(),"String_Node_Str" + name,"String_Node_Str" + cpu,"String_Node_Str" + ramSize,"String_Node_Str" + speed,"String_Node_Str" + displayText,"String_Node_Str" + guestIpType,"String_Node_Str" + localStorageRequired,"String_Node_Str" + offerHA,"String_Node_Str" + useVirtualNetwork,"String_Node_Str" + tags);
    return offering;
  }
 else {
    return null;
  }
}
Program: 107237
Project: 107237
Buggy source:
public NetworkOffering.GuestIpType getGuestIpType(){
  return guestIpType;
}

Fixed version (ground truth):
public Network.GuestIpType getGuestIpType(){
  return guestIpType;
}
Program: 107238
Project: 107238
Buggy source:
public void setGuestIpType(NetworkOffering.GuestIpType guestIpType){
  this.guestIpType=guestIpType;
}

Fixed version (ground truth):
public void setGuestIpType(Network.GuestIpType guestIpType){
  this.guestIpType=guestIpType;
}
Program: 107239
Project: 107239
Buggy source:
public ServiceOffering20VO(Long id,String name,int cpu,int ramSize,int speed,int rateMbps,int multicastRateMbps,boolean offerHA,String displayText,NetworkOffering.GuestIpType guestIpType,boolean useLocalStorage){
  this.id=id;
  this.name=name;
  this.cpu=cpu;
  this.ramSize=ramSize;
  this.speed=speed;
  this.rateMbps=rateMbps;
  this.multicastRateMbps=multicastRateMbps;
  this.offerHA=offerHA;
  this.displayText=displayText;
  this.guestIpType=guestIpType;
  this.useLocalStorage=useLocalStorage;
}

Fixed version (ground truth):
public ServiceOffering20VO(Long id,String name,int cpu,int ramSize,int speed,int rateMbps,int multicastRateMbps,boolean offerHA,String displayText,Network.GuestIpType guestIpType,boolean useLocalStorage){
  this.id=id;
  this.name=name;
  this.cpu=cpu;
  this.ramSize=ramSize;
  this.speed=speed;
  this.rateMbps=rateMbps;
  this.multicastRateMbps=multicastRateMbps;
  this.offerHA=offerHA;
  this.displayText=displayText;
  this.guestIpType=guestIpType;
  this.useLocalStorage=useLocalStorage;
}
Program: 107240
Project: 107240
Buggy source:
@Override public NetworkOffering.GuestIpType getGuestIpType(){
  return guestIpType;
}

Fixed version (ground truth):
@Override public Network.GuestIpType getGuestIpType(){
  return guestIpType;
}
Program: 107241
Project: 107241
Buggy source:
public ServiceOffering21VO(String name,int cpu,int ramSize,int speed,int rateMbps,int multicastRateMbps,boolean offerHA,String displayText,NetworkOffering.GuestIpType guestIpType,boolean useLocalStorage,boolean recreatable,String tags){
  super(name,displayText,false,tags,recreatable,useLocalStorage);
  this.cpu=cpu;
  this.ramSize=ramSize;
  this.speed=speed;
  this.rateMbps=rateMbps;
  this.multicastRateMbps=multicastRateMbps;
  this.offerHA=offerHA;
  this.guestIpType=guestIpType;
}

Fixed version (ground truth):
public ServiceOffering21VO(String name,int cpu,int ramSize,int speed,int rateMbps,int multicastRateMbps,boolean offerHA,String displayText,Network.GuestIpType guestIpType,boolean useLocalStorage,boolean recreatable,String tags){
  super(name,displayText,false,tags,recreatable,useLocalStorage);
  this.cpu=cpu;
  this.ramSize=ramSize;
  this.speed=speed;
  this.rateMbps=rateMbps;
  this.multicastRateMbps=multicastRateMbps;
  this.offerHA=offerHA;
  this.guestIpType=guestIpType;
}
Program: 107242
Project: 107242
Buggy source:
public void setGuestIpType(NetworkOffering.GuestIpType guestIpType){
  this.guestIpType=guestIpType;
}

Fixed version (ground truth):
public void setGuestIpType(Network.GuestIpType guestIpType){
  this.guestIpType=guestIpType;
}
Program: 107244
Project: 107244
Buggy source:
public Long getNetworkId(){
}

Fixed version (ground truth):
public Long getNetworkId(){
  Network network=_networkService.getNetwork(networkId);
  if (network == null) {
    throw new InvalidParameterValueException("String_Node_Str" + networkId);
  }
 else {
    return network.getId();
  }
}
Program: 107245
Project: 107245
Buggy source:
public long getEntityOwnerId(){
}

Fixed version (ground truth):
public long getEntityOwnerId(){
  return _networkService.getNetwork(networkId).getAccountId();
}
Program: 107249
Project: 107249
Buggy source:
@Override public void reserve(NicProfile nic,Network config,VirtualMachineProfile<? extends VirtualMachine> vm,DeployDestination dest,ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
  Pod pod=dest.getPod();
  Pair<String,Long> ip=_dcDao.allocatePrivateIpAddress(dest.getDataCenter().getId(),dest.getPod().getId(),nic.getId(),context.getReservationId());
  if (ip == null) {
    throw new InsufficientAddressCapacityException("String_Node_Str",Pod.class,pod.getId());
  }
  nic.setIp4Address(ip.first());
  nic.setMacAddress(NetUtils.long2Mac(ip.second()));
  nic.setGateway(pod.getGateway());
  nic.setFormat(AddressFormat.Ip4);
  String netmask=NetUtils.getCidrSubNet(pod.getCidrAddress(),pod.getCidrSize());
  nic.setNetmask(netmask);
  nic.setBroadcastType(BroadcastDomainType.Native);
  nic.setBroadcastUri(null);
  nic.setIsolationUri(null);
  nic.setFormat(AddressFormat.Ip4);
  s_logger.debug("String_Node_Str" + nic + "String_Node_Str"+ vm);
}

Fixed version (ground truth):
@Override public void reserve(NicProfile nic,Network config,VirtualMachineProfile<? extends VirtualMachine> vm,DeployDestination dest,ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
  Pod pod=dest.getPod();
  Pair<String,Long> ip=_dcDao.allocatePrivateIpAddress(dest.getDataCenter().getId(),dest.getPod().getId(),nic.getId(),context.getReservationId());
  if (ip == null) {
    throw new InsufficientAddressCapacityException("String_Node_Str",Pod.class,pod.getId());
  }
  nic.setIp4Address(ip.first());
  nic.setMacAddress(NetUtils.long2Mac(ip.second()));
  nic.setGateway(pod.getGateway());
  nic.setFormat(AddressFormat.Ip4);
  String netmask=NetUtils.getCidrNetmask(pod.getCidrSize());
  nic.setNetmask(netmask);
  nic.setBroadcastType(BroadcastDomainType.Native);
  nic.setBroadcastUri(null);
  nic.setIsolationUri(null);
  nic.setFormat(AddressFormat.Ip4);
  s_logger.debug("String_Node_Str" + nic + "String_Node_Str"+ vm);
}
Program: 107251
Project: 107251
Buggy source:
public SnapshotVO(long id,long accountId,long volumeId,String path,String name,short snapshotType,String typeDescription){
  this.id=id;
  this.accountId=accountId;
  this.volumeId=volumeId;
  this.path=path;
  this.name=name;
  this.snapshotType=snapshotType;
  this.typeDescription=typeDescription;
  this.status=Status.Creating;
  this.prevSnapshotId=0;
}

Fixed version (ground truth):
public SnapshotVO(long id,long accountId,long volumeId,String path,String name,short snapshotType,String typeDescription,HypervisorType hypervisorType){
  this.id=id;
  this.accountId=accountId;
  this.volumeId=volumeId;
  this.path=path;
  this.name=name;
  this.snapshotType=snapshotType;
  this.typeDescription=typeDescription;
  this.status=Status.Creating;
  this.prevSnapshotId=0;
  this.hypervisorType=hypervisorType;
}
Program: 107252
Project: 107252
Buggy source:
@DB protected VolumeVO createVolumeFromSnapshot(VolumeVO volume,long snapshotId){
  VolumeVO createdVolume=null;
  SnapshotVO snapshot=_snapshotDao.findById(snapshotId);
  Long origVolumeId=snapshot.getVolumeId();
  VolumeVO originalVolume=_volsDao.findById(origVolumeId);
  VMTemplateVO template=null;
  if (originalVolume != null) {
    template=_templateDao.findById(originalVolume.getTemplateId());
  }
  Pair<VolumeVO,String> volumeDetails=createVolumeFromSnapshot(volume,snapshot,template,originalVolume.getSize());
  createdVolume=volumeDetails.first();
  Transaction txn=Transaction.currentTxn();
  txn.start();
  Long templateId=originalVolume.getTemplateId();
  ;
  Long diskOfferingId=originalVolume.getDiskOfferingId();
  long sizeMB=createdVolume.getSize() / (1024 * 1024);
  if (createdVolume.getPath() != null) {
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE,volume.getAccountId(),volume.getDataCenterId(),volume.getId(),volume.getName(),diskOfferingId,templateId,sizeMB);
    _usageEventDao.persist(usageEvent);
  }
  txn.commit();
  return createdVolume;
}

Fixed version (ground truth):
@DB protected VolumeVO createVolumeFromSnapshot(VolumeVO volume,long snapshotId){
  VolumeVO createdVolume=null;
  SnapshotVO snapshot=_snapshotDao.findById(snapshotId);
  Long origVolumeId=snapshot.getVolumeId();
  VolumeVO originalVolume=_volsDao.findById(origVolumeId);
  VMTemplateVO template=null;
  if (originalVolume != null) {
    template=_templateDao.findById(originalVolume.getTemplateId());
  }
  Pair<VolumeVO,String> volumeDetails=createVolumeFromSnapshot(volume,snapshot,originalVolume.getSize());
  createdVolume=volumeDetails.first();
  Transaction txn=Transaction.currentTxn();
  txn.start();
  Long templateId=originalVolume.getTemplateId();
  ;
  Long diskOfferingId=originalVolume.getDiskOfferingId();
  long sizeMB=createdVolume.getSize() / (1024 * 1024);
  if (createdVolume.getPath() != null) {
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE,volume.getAccountId(),volume.getDataCenterId(),volume.getId(),volume.getName(),diskOfferingId,templateId,sizeMB);
    _usageEventDao.persist(usageEvent);
  }
  txn.commit();
  return createdVolume;
}
Program: 107254
Project: 107254
Buggy source:
private UserAccount getUserAccount(String username,String password,Long domainId){
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + username + "String_Node_Str"+ domainId);
  }
  UserAccount userAccount=_userAccountDao.getUserAccount(username,domainId);
  if (userAccount == null) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + username + "String_Node_Str"+ domainId);
    }
    return null;
  }
  DomainVO domain=_domainDao.findById(domainId);
  String domainName=null;
  if (domain != null) {
    domainName=domain.getName();
  }
  if (!userAccount.getState().equals("String_Node_Str") || !userAccount.getAccountState().equals("String_Node_Str")) {
    if (s_logger.isInfoEnabled()) {
      s_logger.info("String_Node_Str" + username + "String_Node_Str"+ domainName+ "String_Node_Str");
    }
    throw new CloudAuthenticationException("String_Node_Str" + username + "String_Node_Str"+ domainName+ "String_Node_Str");
  }
  Enumeration<UserAuthenticator> en=_userAuthenticators.enumeration();
  UserAuthenticator authenticator=en.nextElement();
  boolean authenticated=authenticator.authenticate(username,password,domainId);
  if (authenticated) {
    return userAccount;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private UserAccount getUserAccount(String username,String password,Long domainId){
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + username + "String_Node_Str"+ domainId);
  }
  UserAccount userAccount=_userAccountDao.getUserAccount(username,domainId);
  if (userAccount == null) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + username + "String_Node_Str"+ domainId);
    }
    return null;
  }
  DomainVO domain=_domainDao.findById(domainId);
  String domainName=null;
  if (domain != null) {
    domainName=domain.getName();
  }
  if (!userAccount.getState().equalsIgnoreCase(Account.State.Enabled.toString()) || !userAccount.getAccountState().equalsIgnoreCase(Account.State.Enabled.toString())) {
    if (s_logger.isInfoEnabled()) {
      s_logger.info("String_Node_Str" + username + "String_Node_Str"+ domainName+ "String_Node_Str");
    }
    throw new CloudAuthenticationException("String_Node_Str" + username + "String_Node_Str"+ domainName+ "String_Node_Str");
  }
  Enumeration<UserAuthenticator> en=_userAuthenticators.enumeration();
  UserAuthenticator authenticator=en.nextElement();
  boolean authenticated=authenticator.authenticate(username,password,domainId);
  if (authenticated) {
    return userAccount;
  }
 else {
    return null;
  }
}
Program: 107255
Project: 107255
Buggy source:
@Override public void create(){
  long id=_snapshotService.getNextInSequence(this);
  this.setEntityId(id);
}

Fixed version (ground truth):
@Override public void create(){
  Long id=_snapshotService.getNextInSequence(this);
  this.setEntityId(id);
}
Program: 107256
Project: 107256
Buggy source:
@Override public void execute(){
  try {
    Snapshot snapshot=_snapshotService.createSnapshot(this);
    if (snapshot != null) {
      SnapshotResponse response=_responseGenerator.createSnapshotResponse(snapshot);
      response.setResponseName(getCommandName());
      this.setResponseObject(response);
    }
 else {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str" + volumeId);
    }
  }
 catch (  ResourceAllocationException ex) {
    s_logger.warn("String_Node_Str",ex);
    throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR,ex.getMessage());
  }
}

Fixed version (ground truth):
@Override public void execute(){
  try {
    if (this.getEntityId() == null) {
      Long id=_snapshotService.getNextInSequence(this);
      this.setEntityId(id);
    }
    Snapshot snapshot=_snapshotService.createSnapshot(this);
    if (snapshot != null) {
      SnapshotResponse response=_responseGenerator.createSnapshotResponse(snapshot);
      response.setResponseName(getCommandName());
      this.setResponseObject(response);
    }
 else {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str" + volumeId);
    }
  }
 catch (  ResourceAllocationException ex) {
    s_logger.warn("String_Node_Str",ex);
    throw new ServerApiException(BaseCmd.RESOURCE_ALLOCATION_ERROR,ex.getMessage());
  }
}
Program: 107259
Project: 107259
Buggy source:
protected T findById(ID id,boolean removed,Boolean lock){
  StringBuilder sql=new StringBuilder(_selectByIdSql);
  if (!removed && _removed != null) {
    sql.append("String_Node_Str").append(_removed.first());
  }
  if (lock != null) {
    sql.append(lock ? FOR_UPDATE_CLAUSE : SHARE_MODE_CLAUSE);
  }
  Transaction txn=Transaction.currentTxn();
  PreparedStatement pstmt=s_initStmt;
  try {
    pstmt=txn.prepareAutoCloseStatement(sql.toString());
    if (_idField.getAnnotation(EmbeddedId.class) == null) {
      pstmt.setObject(1,id);
    }
    ResultSet rs=pstmt.executeQuery();
    return rs.next() ? toEntityBean(rs,true) : null;
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str" + pstmt.toString(),e);
  }
}

Fixed version (ground truth):
protected T findById(ID id,boolean removed,Boolean lock){
  StringBuilder sql=new StringBuilder(_selectByIdSql);
  if (!removed && _removed != null) {
    sql.append("String_Node_Str").append(_removed.first());
  }
  if (lock != null) {
    sql.append(lock ? FOR_UPDATE_CLAUSE : SHARE_MODE_CLAUSE);
  }
  Transaction txn=Transaction.currentTxn();
  PreparedStatement pstmt=s_initStmt;
  try {
    pstmt=txn.prepareAutoCloseStatement(sql.toString());
    if (_idField.getAnnotation(EmbeddedId.class) == null) {
      prepareAttribute(1,pstmt,_idAttributes.get(_table)[0],id);
    }
    ResultSet rs=pstmt.executeQuery();
    return rs.next() ? toEntityBean(rs,true) : null;
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str" + pstmt.toString(),e);
  }
}
Program: 107260
Project: 107260
Buggy source:
boolean mark(long dcId,String ip);

Fixed version (ground truth):
boolean mark(long dcId,Ip ip);
Program: 107261
Project: 107261
Buggy source:
@Override public boolean mark(long dcId,String ip){
  SearchCriteria<IPAddressVO> sc=AllFieldsSearch.create();
  sc.setParameters("String_Node_Str",dcId);
  sc.setParameters("String_Node_Str",ip);
  IPAddressVO vo=createForUpdate();
  vo.setAllocatedTime(new Date());
  vo.setState(State.Allocated);
  return update(vo,sc) >= 1;
}

Fixed version (ground truth):
@Override public boolean mark(long dcId,Ip ip){
  SearchCriteria<IPAddressVO> sc=AllFieldsSearch.create();
  sc.setParameters("String_Node_Str",dcId);
  sc.setParameters("String_Node_Str",ip);
  IPAddressVO vo=createForUpdate();
  vo.setAllocatedTime(new Date());
  vo.setState(State.Allocated);
  return update(vo,sc) >= 1;
}
Program: 107262
Project: 107262
Buggy source:
private boolean canHandle(GuestIpType ipType,DeployDestination dest){
  DataCenter dc=dest.getDataCenter();
  String provider=dc.getGatewayProvider();
  if (!dc.getDhcpProvider().equals(Provider.VirtualRouter.getName())) {
    return false;
  }
  return ((ipType == GuestIpType.Virtual && !provider.equals(Provider.VirtualRouter.getName())) || (ipType == GuestIpType.Direct || ipType == GuestIpType.DirectPodBased));
}

Fixed version (ground truth):
private boolean canHandle(GuestIpType ipType,DeployDestination dest){
  DataCenter dc=dest.getDataCenter();
  String provider=dc.getGatewayProvider();
  return ((ipType == GuestIpType.Virtual && !provider.equals(Provider.VirtualRouter.getName())) || (provider.equals(Provider.VirtualRouter.getName()) && (ipType == GuestIpType.Direct || ipType == GuestIpType.DirectPodBased)));
}
Program: 107263
Project: 107263
Buggy source:
@Override public List<? extends PortForwardingRule> listPortForwardingRules(ListPortForwardingRulesCmd cmd){
  Ip ipAddress=new Ip(cmd.getIpAddress());
  Account caller=UserContext.current().getAccount();
  IPAddressVO ipAddressVO=_ipAddressDao.findById(ipAddress.addr());
  if (ipAddressVO == null || !ipAddressVO.readyToUse()) {
    throw new InvalidParameterValueException("String_Node_Str" + ipAddress);
  }
  List<PortForwardingRuleVO> rules=_forwardingDao.listByIpAndNotRevoked(ipAddress);
  _accountMgr.checkAccess(caller,rules.toArray(new PortForwardingRuleVO[rules.size()]));
  return rules;
}

Fixed version (ground truth):
@Override public List<? extends PortForwardingRule> listPortForwardingRules(ListPortForwardingRulesCmd cmd){
  Ip ipAddress=new Ip(cmd.getIpAddress());
  Account caller=UserContext.current().getAccount();
  IPAddressVO ipAddressVO=_ipAddressDao.findById(ipAddress.addr());
  if (ipAddressVO == null || !ipAddressVO.readyToUse()) {
    throw new InvalidParameterValueException("String_Node_Str" + ipAddress);
  }
  List<PortForwardingRuleVO> rules=_forwardingDao.listByIp(ipAddress);
  _accountMgr.checkAccess(caller,rules.toArray(new PortForwardingRuleVO[rules.size()]));
  return rules;
}
Program: 107264
Project: 107264
Buggy source:
@Override public <T extends VMInstanceVO>DiskProfile allocateRawVolume(VolumeType type,String name,DiskOfferingVO offering,Long size,T vm,Account owner){
  if (size == null) {
    size=offering.getDiskSizeInBytes();
  }
  VolumeVO vol=new VolumeVO(type,name,vm.getDataCenterId(),owner.getDomainId(),owner.getId(),offering.getId(),size);
  if (vm != null) {
    vol.setInstanceId(vm.getId());
  }
  if (type.equals(VolumeType.ROOT)) {
    vol.setDeviceId(0l);
  }
 else {
    vol.setDeviceId(1l);
  }
  vol=_volsDao.persist(vol);
  if (vm instanceof UserVm) {
    long sizeMB=size / (1024 * 1024);
    EventUtils.saveEvent(User.UID_SYSTEM,vol.getAccountId(),EventTypes.EVENT_VOLUME_CREATE,"String_Node_Str" + vol.getName() + "String_Node_Str"+ sizeMB+ "String_Node_Str");
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE,vol.getAccountId(),vol.getDataCenterId(),vol.getId(),vol.getName(),offering.getId(),null,sizeMB);
    _usageEventDao.persist(usageEvent);
  }
  return toDiskProfile(vol,offering);
}

Fixed version (ground truth):
@Override public <T extends VMInstanceVO>DiskProfile allocateRawVolume(VolumeType type,String name,DiskOfferingVO offering,Long size,T vm,Account owner){
  long userId=UserContext.current().getUserId();
  if (size == null) {
    size=offering.getDiskSizeInBytes();
  }
  VolumeVO vol=new VolumeVO(type,name,vm.getDataCenterId(),owner.getDomainId(),owner.getId(),offering.getId(),size);
  if (vm != null) {
    vol.setInstanceId(vm.getId());
  }
  if (type.equals(VolumeType.ROOT)) {
    vol.setDeviceId(0l);
  }
 else {
    vol.setDeviceId(1l);
  }
  vol=_volsDao.persist(vol);
  if (vm instanceof UserVm) {
    long sizeMB=size / (1024 * 1024);
    EventUtils.saveEvent(userId,vol.getAccountId(),EventTypes.EVENT_VOLUME_CREATE,"String_Node_Str" + vol.getName() + "String_Node_Str"+ sizeMB+ "String_Node_Str");
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE,vol.getAccountId(),vol.getDataCenterId(),vol.getId(),vol.getName(),offering.getId(),null,sizeMB);
    _usageEventDao.persist(usageEvent);
    _accountMgr.incrementResourceCount(vm.getAccountId(),ResourceType.volume);
  }
  return toDiskProfile(vol,offering);
}
Program: 107266
Project: 107266
Buggy source:
@Override public UserVm destroyVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException {
  Account account=UserContext.current().getAccount();
  Long userId=UserContext.current().getUserId();
  UserVmVO vm=_vmDao.findById(vmId);
  if (vm == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + vmId);
  }
  userId=accountAndUserValidation(vmId,account,userId,vm);
  User caller=_userDao.findById(userId);
  boolean status;
  status=_itMgr.destroy(vm,caller,account);
  if (status) {
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VM_DESTROY,vm.getAccountId(),vm.getDataCenterId(),vm.getId(),vm.getName(),vm.getServiceOfferingId(),vm.getTemplateId(),null);
    _usageEventDao.persist(usageEvent);
    return _vmDao.findById(vmId);
  }
 else {
    throw new CloudRuntimeException("String_Node_Str" + vmId);
  }
}

Fixed version (ground truth):
@Override public UserVm destroyVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException {
  Account account=UserContext.current().getAccount();
  Long userId=UserContext.current().getUserId();
  UserVmVO vm=_vmDao.findById(vmId);
  if (vm == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + vmId);
  }
  userId=accountAndUserValidation(vmId,account,userId,vm);
  User caller=_userDao.findById(userId);
  boolean status;
  status=_itMgr.destroy(vm,caller,account);
  if (status) {
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VM_DESTROY,vm.getAccountId(),vm.getDataCenterId(),vm.getId(),vm.getName(),vm.getServiceOfferingId(),vm.getTemplateId(),null);
    _usageEventDao.persist(usageEvent);
    _accountMgr.decrementResourceCount(vm.getAccountId(),ResourceType.user_vm);
    return _vmDao.findById(vmId);
  }
 else {
    throw new CloudRuntimeException("String_Node_Str" + vmId);
  }
}
Program: 107267
Project: 107267
Buggy source:
@Override @DB public boolean destroyVirtualMachine(long userId,long vmId){
  UserVmVO vm=_vmDao.findById(vmId);
  if (vm == null || vm.getState() == State.Destroyed || vm.getState() == State.Expunging || vm.getRemoved() != null) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + vmId);
    }
    return true;
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vmId);
  }
  long startEventId=EventUtils.saveStartedEvent(userId,vm.getAccountId(),EventTypes.EVENT_VM_STOP,"String_Node_Str" + vmId);
  if (!stop(userId,vm)) {
    s_logger.error("String_Node_Str" + vmId);
    EventUtils.saveEvent(userId,vm.getAccountId(),EventVO.LEVEL_ERROR,EventTypes.EVENT_VM_STOP,"String_Node_Str" + vmId,startEventId);
    return false;
  }
 else {
    EventUtils.saveEvent(userId,vm.getAccountId(),EventVO.LEVEL_INFO,EventTypes.EVENT_VM_STOP,"String_Node_Str" + vmId,startEventId);
  }
  Transaction txn=Transaction.currentTxn();
  txn.start();
  _accountMgr.decrementResourceCount(vm.getAccountId(),ResourceType.user_vm);
  if (!destroy(vm)) {
    return false;
  }
  UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VM_DESTROY,vm.getAccountId(),vm.getDataCenterId(),vm.getId(),vm.getName(),vm.getServiceOfferingId(),vm.getTemplateId(),null);
  _usageEventDao.persist(usageEvent);
  cleanNetworkRules(userId,vmId);
  List<VolumeVO> volumes=_volsDao.findByInstance(vmId);
  for (  VolumeVO volume : volumes) {
    _storageMgr.destroyVolume(volume);
  }
  txn.commit();
  return true;
}

Fixed version (ground truth):
@Override @DB public boolean destroyVirtualMachine(long userId,long vmId){
  UserVmVO vm=_vmDao.findById(vmId);
  if (vm == null || vm.getState() == State.Destroyed || vm.getState() == State.Expunging || vm.getRemoved() != null) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + vmId);
    }
    return true;
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vmId);
  }
  long startEventId=EventUtils.saveStartedEvent(userId,vm.getAccountId(),EventTypes.EVENT_VM_STOP,"String_Node_Str" + vmId);
  if (!stop(userId,vm)) {
    s_logger.error("String_Node_Str" + vmId);
    EventUtils.saveEvent(userId,vm.getAccountId(),EventVO.LEVEL_ERROR,EventTypes.EVENT_VM_STOP,"String_Node_Str" + vmId,startEventId);
    return false;
  }
 else {
    EventUtils.saveEvent(userId,vm.getAccountId(),EventVO.LEVEL_INFO,EventTypes.EVENT_VM_STOP,"String_Node_Str" + vmId,startEventId);
  }
  Transaction txn=Transaction.currentTxn();
  txn.start();
  if (!destroy(vm)) {
    return false;
  }
  UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VM_DESTROY,vm.getAccountId(),vm.getDataCenterId(),vm.getId(),vm.getName(),vm.getServiceOfferingId(),vm.getTemplateId(),null);
  _usageEventDao.persist(usageEvent);
  cleanNetworkRules(userId,vmId);
  List<VolumeVO> volumes=_volsDao.findByInstance(vmId);
  for (  VolumeVO volume : volumes) {
    _storageMgr.destroyVolume(volume);
  }
  txn.commit();
  return true;
}
Program: 107271
Project: 107271
Buggy source:
@Override public void cleanupVolumes(Long vmId){
  List<VolumeVO> volumesForVm=_volsDao.findByInstance(vmId);
  for (  VolumeVO vol : volumesForVm) {
    destroyVolume(vol);
  }
}

Fixed version (ground truth):
@Override public void cleanupVolumes(Long vmId){
  List<VolumeVO> volumesForVm=_volsDao.findByInstance(vmId);
  for (  VolumeVO vol : volumesForVm) {
    if (vol.getVolumeType().equals(VolumeType.ROOT)) {
      destroyVolume(vol);
    }
 else {
      _volsDao.detachVolume(vol.getId());
    }
  }
}
Program: 107273
Project: 107273
Buggy source:
@Override public boolean applyLBRules(Network network,List<? extends FirewallRule> rules){
}

Fixed version (ground truth):
@Override public boolean applyLBRules(Network network,List<? extends FirewallRule> rules){
  DomainRouterVO router=_routerDao.findByNetworkConfiguration(network.getId());
  if (router == null) {
    s_logger.warn("String_Node_Str" + network.getId());
    throw new ResourceUnavailableException("String_Node_Str");
  }
  String routerControlIpAddress=router.getPrivateIpAddress();
  if (router.getState() == State.Running || router.getState() == State.Starting) {
    Commands cmds=new Commands(OnError.Continue);
    LoadBalancerTO[] lbs=new LoadBalancerTO[rules.size()];
    int i=0;
    for (    FirewallRule fwRule : rules) {
      LoadBalancingRule rule=(LoadBalancingRule)fwRule;
      boolean revoked=(rule.getState().equals(FirewallRule.State.Revoke));
      String protocol=rule.getProtocol();
      String algorithm=rule.getAlgorithm();
      String srcIp=rule.getSourceIpAddress().addr();
      int srcPort=rule.getSourcePortStart();
      List<LbDestination> destinations=rule.getDestinations();
      LoadBalancerTO lb=new LoadBalancerTO(srcIp,srcPort,protocol,algorithm,revoked,false,destinations);
      lbs[i++]=lb;
    }
    LoadBalancerConfigCommand cmd=new LoadBalancerConfigCommand(lbs);
    cmd.setAccessDetail(RoutingCommand.ROUTER_IP,router.getPrivateIpAddress());
    cmd.setAccessDetail(RoutingCommand.ROUTER_NAME,router.getInstanceName());
    cmds.addCommand(cmd);
    return sendCommandsToRouter(router,cmds);
  }
 else   if (router.getState() == State.Stopped || router.getState() == State.Stopping) {
    s_logger.debug("String_Node_Str" + router.getState() + "String_Node_Str");
    return true;
  }
 else {
    s_logger.warn("String_Node_Str" + router.getState());
    throw new ResourceUnavailableException("String_Node_Str" + router.getState());
  }
}
Program: 107274
Project: 107274
Buggy source:
public <T>URI toUri(T value){
  try {
    return new URI(scheme + "String_Node_Str" + value.toString());
  }
 catch (  URISyntaxException e) {
    throw new CloudRuntimeException("String_Node_Str" + value);
  }
}

Fixed version (ground truth):
public <T>URI toUri(T value){
}
Program: 107275
Project: 107275
Buggy source:
protected void getIp(NicProfile nic,DataCenter dc,VirtualMachineProfile<? extends VirtualMachine> vm,Network network) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
  if (nic.getIp4Address() == null) {
    PublicIp ip=_networkMgr.assignPublicIpAddress(dc.getId(),vm.getOwner(),VlanType.VirtualNetwork,null);
    nic.setIp4Address(ip.getAddress());
    nic.setGateway(ip.getGateway());
    nic.setNetmask(ip.getNetmask());
    nic.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
    nic.setBroadcastType(BroadcastDomainType.Vlan);
    nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(ip.getVlanTag()));
    nic.setFormat(AddressFormat.Ip4);
    nic.setReservationId(String.valueOf(ip.getVlanTag()));
    nic.setMacAddress(ip.getMacAddress());
  }
  nic.setDns1(dc.getDns1());
  nic.setDns2(dc.getDns2());
}

Fixed version (ground truth):
protected void getIp(NicProfile nic,DataCenter dc,VirtualMachineProfile<? extends VirtualMachine> vm,Network network) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
  if (nic.getIp4Address() == null) {
    PublicIp ip=_networkMgr.assignPublicIpAddress(dc.getId(),vm.getOwner(),dc.getNetworkType().equals(NetworkType.Basic) ? VlanType.DirectAttached : VlanType.VirtualNetwork,null);
    nic.setIp4Address(ip.getAddress());
    nic.setGateway(ip.getGateway());
    nic.setNetmask(ip.getNetmask());
    nic.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
    nic.setBroadcastType(BroadcastDomainType.Vlan);
    nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(ip.getVlanTag()));
    nic.setFormat(AddressFormat.Ip4);
    nic.setReservationId(String.valueOf(ip.getVlanTag()));
    nic.setMacAddress(ip.getMacAddress());
  }
  nic.setDns1(dc.getDns1());
  nic.setDns2(dc.getDns2());
}
Program: 107276
Project: 107276
Buggy source:
private Discoverer getMatchingDiscover(String hypervisorType){
  Enumeration<Discoverer> en=_discoverers.enumeration();
  while (en.hasMoreElements()) {
    Discoverer discoverer=en.nextElement();
    if (discoverer.matchHypervisor(hypervisorType))     return discoverer;
  }
  return null;
}

Fixed version (ground truth):
private Discoverer getMatchingDiscover(Hypervisor.HypervisorType hypervisorType){
  Enumeration<Discoverer> en=_discoverers.enumeration();
  while (en.hasMoreElements()) {
    Discoverer discoverer=en.nextElement();
    if (discoverer.getHypervisorType() == hypervisorType)     return discoverer;
  }
  return null;
}
Program: 107280
Project: 107280
Buggy source:
@Override public boolean configure(final String name,final Map<String,Object> params) throws ConfigurationException {
  _name=name;
  String maxVolumeSizeInGbString=_configDao.getValue("String_Node_Str");
  _maxVolumeSizeInGb=NumbersUtil.parseInt(maxVolumeSizeInGbString,2000);
  return true;
}

Fixed version (ground truth):
@Override public boolean configure(final String name,final Map<String,Object> params) throws ConfigurationException {
  _name=name;
  String maxVolumeSizeInGbString=_configDao.getValue("String_Node_Str");
  _maxVolumeSizeInGb=NumbersUtil.parseInt(maxVolumeSizeInGbString,2000);
  populateConfigValuesForValidationSet();
  return true;
}
Program: 107282
Project: 107282
Buggy source:
@Override public StoragePool allocateToPool(DiskProfile dskCh,DataCenterVO dc,HostPodVO pod,Long clusterId,VMInstanceVO vm,VMTemplateVO template,Set<? extends StoragePool> avoid){
  if (!allocatorIsCorrectType(dskCh,vm)) {
    return null;
  }
  List<StoragePoolVO> pools=_storagePoolDao.findPoolsByTags(dc.getId(),pod.getId(),clusterId,dskCh.getTags(),null);
  if (pools.size() == 0) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + pod.getId());
    }
    return null;
  }
  StatsCollector sc=StatsCollector.getInstance();
  Collections.shuffle(pools);
  for (  StoragePoolVO pool : pools) {
    if (checkPool(avoid,pool,dskCh,template,null,vm,sc)) {
      return pool;
    }
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str");
  }
  if (_dontMatter && pools.size() > 0) {
    return pools.get(0);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public StoragePool allocateToPool(DiskProfile dskCh,DataCenterVO dc,HostPodVO pod,Long clusterId,VMInstanceVO vm,VMTemplateVO template,Set<? extends StoragePool> avoid){
  if (!allocatorIsCorrectType(dskCh,vm)) {
    return null;
  }
  List<StoragePoolVO> pools=_storagePoolDao.findPoolsByTags(dc.getId(),pod.getId(),clusterId,dskCh.getTags(),null);
  if (pools.size() == 0) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + pod.getId());
    }
    return null;
  }
  StatsCollector sc=StatsCollector.getInstance();
  Collections.shuffle(pools);
  for (  StoragePoolVO pool : pools) {
    if (checkPool(avoid,pool,dskCh,template,null,vm,sc)) {
      return pool;
    }
 else {
      pools.remove(pool);
    }
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str");
  }
  if (_dontMatter && pools.size() > 0) {
    return pools.get(0);
  }
 else {
    return null;
  }
}
Program: 107283
Project: 107283
Buggy source:
private void initialize(UserVm vm,ServiceOffering offering,int networkRate,int multicastRate,VirtualRouter router,String imagePath,String guestNetworkId,int utilization,int cpuWeight,int bits,String isoPath,boolean bootFromISO,String guestOSDescription){
  id=vm.getId();
  guestIpAddress=vm.getGuestIpAddress();
  if (router != null)   gateway=router.getPrivateIpAddress();
  ramSize=offering.getRamSize();
  cpu=offering.getCpu();
  this.utilization=utilization;
  this.cpuWeight=cpuWeight;
  this.imagePath=imagePath;
  this.guestNetworkId=guestNetworkId;
  guestMacAddress=vm.getGuestMacAddress();
  vncPassword=vm.getVncPassword();
  hostName=vm.getHostName();
  networkRateMbps=networkRate;
  networkRateMulticastMbps=multicastRate;
  if (bits == 32) {
    arch="String_Node_Str";
  }
 else {
    arch="String_Node_Str";
  }
  this.isoPath=isoPath;
  this.bootFromISO=bootFromISO;
  this.guestOSDescription=guestOSDescription;
}

Fixed version (ground truth):
private void initialize(UserVm vm,ServiceOffering offering,int networkRate,int multicastRate,VirtualRouter router,String imagePath,String guestNetworkId,int utilization,int cpuWeight,int bits,String isoPath,boolean bootFromISO,String guestOSDescription){
  id=vm.getId();
  guestIpAddress=vm.getGuestIpAddress();
  if (router != null)   gateway=router.getPrivateIpAddress();
  ramSize=offering.getRamSize();
  cpu=offering.getCpu();
  this.utilization=utilization;
  this.cpuWeight=cpuWeight;
  this.imagePath=imagePath;
  this.guestNetworkId=guestNetworkId;
  guestMacAddress=vm.getGuestMacAddress();
  vncPassword=vm.getVncPassword();
  hostName=vm.getName();
  networkRateMbps=networkRate;
  networkRateMulticastMbps=multicastRate;
  if (bits == 32) {
    arch="String_Node_Str";
  }
 else {
    arch="String_Node_Str";
  }
  this.isoPath=isoPath;
  this.bootFromISO=bootFromISO;
  this.guestOSDescription=guestOSDescription;
}