nus-yam/ex-repair huggingface dataset:
Program: 89790
Project: 89790
Buggy source:
@Override public boolean configure(String name,Map<String,Object> xmlParams) throws ConfigurationException {
  _name=name;
  ComponentLocator locator=ComponentLocator.getCurrentLocator();
  ConfigurationDao configDao=locator.getDao(ConfigurationDao.class);
  Map<String,String> params=configDao.getConfiguration(xmlParams);
  _retry=NumbersUtil.parseInt(params.get(Config.StartRetry.key()),10);
  ReservationContextImpl.setComponents(_userDao,_domainDao,_accountDao);
  VirtualMachineProfileImpl.setComponents(_offeringDao,_templateDao,_accountDao);
  Adapters<HypervisorGuru> hvGurus=locator.getAdapters(HypervisorGuru.class);
  for (  HypervisorGuru guru : hvGurus) {
    _hvGurus.put(guru.getHypervisorType(),guru);
  }
  _cancelWait=NumbersUtil.parseLong(params.get(Config.VmOpCancelInterval.key()),3600);
  _cleanupWait=NumbersUtil.parseLong(params.get(Config.VmOpCleanupWait.key()),3600);
  _cleanupInterval=NumbersUtil.parseLong(params.get(Config.VmOpCleanupInterval.key()),86400) * 1000;
  _opWaitInterval=NumbersUtil.parseLong(params.get(Config.VmOpWaitInterval.key()),120) * 1000;
  _lockStateRetry=NumbersUtil.parseInt(params.get(Config.VmOpLockStateRetry.key()),5);
  _operationTimeout=NumbersUtil.parseInt(params.get(Config.Wait.key()),1800) * 2;
  _executor=Executors.newScheduledThreadPool(1,new NamedThreadFactory("String_Node_Str"));
  _nodeId=_clusterMgr.getId();
  _stateMachine.registerListener(this);
  _agentMgr.registerForHostEvents(this,true,true,true);
  return true;
}

Fixed version (ground truth):
@Override public boolean configure(String name,Map<String,Object> xmlParams) throws ConfigurationException {
  _name=name;
  ComponentLocator locator=ComponentLocator.getCurrentLocator();
  ConfigurationDao configDao=locator.getDao(ConfigurationDao.class);
  Map<String,String> params=configDao.getConfiguration(xmlParams);
  _retry=NumbersUtil.parseInt(params.get(Config.StartRetry.key()),10);
  ReservationContextImpl.setComponents(_userDao,_domainDao,_accountDao);
  VirtualMachineProfileImpl.setComponents(_offeringDao,_templateDao,_accountDao);
  Adapters<HypervisorGuru> hvGurus=locator.getAdapters(HypervisorGuru.class);
  for (  HypervisorGuru guru : hvGurus) {
    _hvGurus.put(guru.getHypervisorType(),guru);
  }
  _cancelWait=NumbersUtil.parseLong(params.get(Config.VmOpCancelInterval.key()),3600);
  _cleanupWait=NumbersUtil.parseLong(params.get(Config.VmOpCleanupWait.key()),3600);
  _cleanupInterval=NumbersUtil.parseLong(params.get(Config.VmOpCleanupInterval.key()),86400) * 1000;
  _opWaitInterval=NumbersUtil.parseLong(params.get(Config.VmOpWaitInterval.key()),120) * 1000;
  _lockStateRetry=NumbersUtil.parseInt(params.get(Config.VmOpLockStateRetry.key()),5);
  _operationTimeout=NumbersUtil.parseInt(params.get(Config.Wait.key()),1800) * 2;
  _executor=Executors.newScheduledThreadPool(1,new NamedThreadFactory("String_Node_Str"));
  _nodeId=_clusterMgr.getId();
  _agentMgr.registerForHostEvents(this,true,true,true);
  return true;
}
Program: 89791
Project: 89791
Buggy source:
/** 
 * Event is triggered after state machine transition finished
 * @param oldState VM's old state
 * @param event that triggered this VM state change
 * @param newState VM's new state
 * @param vo the VM instance
 * @param status the state transition is allowed or not
 * @return
 */
public boolean postStateTransitionEvent(S oldState,E event,S newState,V vo,boolean status);

Fixed version (ground truth):
/** 
 * Event is triggered after state machine transition finished
 * @param oldState VM's old state
 * @param event that triggered this VM state change
 * @param newState VM's new state
 * @param vo the VM instance
 * @param status the state transition is allowed or not
 * @return
 */
public boolean postStateTransitionEvent(S oldState,E event,S newState,V vo,boolean status,Long id);
Program: 89792
Project: 89792
Buggy source:
public boolean transitTo(V vo,E e,Long id,StateDao<S,E,V> dao){
  S currentState=vo.getState();
  S nextState=getNextState(currentState,e);
  boolean transitionStatus=true;
  if (nextState == null) {
    transitionStatus=false;
  }
  for (  StateListener<S,E,V> listener : _listeners) {
    listener.preStateTransitionEvent(currentState,e,nextState,vo,transitionStatus,id);
  }
  transitionStatus=dao.updateState(currentState,e,nextState,vo,id);
  for (  StateListener<S,E,V> listener : _listeners) {
    listener.postStateTransitionEvent(currentState,e,nextState,vo,transitionStatus);
  }
  return transitionStatus;
}

Fixed version (ground truth):
public boolean transitTo(V vo,E e,Long id,StateDao<S,E,V> dao){
  S currentState=vo.getState();
  S nextState=getNextState(currentState,e);
  boolean transitionStatus=true;
  if (nextState == null) {
    transitionStatus=false;
  }
  for (  StateListener<S,E,V> listener : _listeners) {
    listener.preStateTransitionEvent(currentState,e,nextState,vo,transitionStatus,id);
  }
  Long oldHostId=vo.getHostId();
  transitionStatus=dao.updateState(currentState,e,nextState,vo,id);
  for (  StateListener<S,E,V> listener : _listeners) {
    listener.postStateTransitionEvent(currentState,e,nextState,vo,transitionStatus,oldHostId);
  }
  return transitionStatus;
}
Program: 89793
Project: 89793
Buggy source:
public String assignPublicIpAddress(final String vmName,final String privateIpAddress,final String publicIpAddress,final boolean add,final boolean sourceNat,final String vlanId,final String vlanGateway,final String vlanNetmask){
  final Script command=new Script(_ipassocPath,_timeout,s_logger);
  if (add) {
    command.add("String_Node_Str");
  }
 else {
    command.add("String_Node_Str");
  }
  if (sourceNat) {
    command.add("String_Node_Str");
  }
  command.add("String_Node_Str",privateIpAddress);
  command.add("String_Node_Str",publicIpAddress);
  command.add("String_Node_Str",vmName);
  command.add("String_Node_Str",vlanNetmask);
  command.add("String_Node_Str","String_Node_Str");
  if (vlanId != null) {
    command.add("String_Node_Str",vlanId);
    command.add("String_Node_Str",vlanGateway);
  }
  return command.execute();
}

Fixed version (ground truth):
protected String assignPublicIpAddress(final String vmName,final String privateIpAddress,final String publicIpAddress,final boolean add,final boolean firstIP,final boolean sourceNat,final String vlanId,final String vlanGateway,final String vlanNetmask,final String vifMacAddress,String guestIp){
  final Script command=new Script(_ipassocPath,_timeout,s_logger);
  command.add(privateIpAddress);
  if (add) {
    command.add("String_Node_Str");
  }
 else {
    command.add("String_Node_Str");
  }
  String cidrSize=Long.toString(NetUtils.getCidrSize(vlanNetmask));
  if (sourceNat) {
    command.add("String_Node_Str");
    command.add("String_Node_Str",publicIpAddress + "String_Node_Str" + cidrSize);
  }
 else   if (firstIP) {
    command.add("String_Node_Str");
    command.add("String_Node_Str",publicIpAddress + "String_Node_Str" + cidrSize);
  }
 else {
    command.add("String_Node_Str",publicIpAddress);
  }
  command.add("String_Node_Str","String_Node_Str");
  return command.execute();
}
Program: 89794
Project: 89794
Buggy source:
@SuppressWarnings("String_Node_Str") private String getLoginSuccessResponse(HttpSession session,String responseType){
  StringBuffer sb=new StringBuffer();
  int inactiveInterval=session.getMaxInactiveInterval();
  if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
    sb.append("String_Node_Str");
    Enumeration attrNames=session.getAttributeNames();
    if (attrNames != null) {
      sb.append("String_Node_Str" + inactiveInterval + "String_Node_Str");
      while (attrNames.hasMoreElements()) {
        String attrName=(String)attrNames.nextElement();
        Object attrObj=session.getAttribute(attrName);
        if ((attrObj instanceof String) || (attrObj instanceof Long)) {
          sb.append("String_Node_Str" + attrName + "String_Node_Str"+ attrObj.toString()+ "String_Node_Str");
        }
      }
    }
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str");
    sb.append("String_Node_Str" + inactiveInterval + "String_Node_Str");
    Enumeration attrNames=session.getAttributeNames();
    if (attrNames != null) {
      while (attrNames.hasMoreElements()) {
        String attrName=(String)attrNames.nextElement();
        String attr=(String)session.getAttribute(attrName);
        sb.append("String_Node_Str" + attrName + "String_Node_Str"+ attr+ "String_Node_Str"+ attrName+ "String_Node_Str");
      }
    }
    sb.append("String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private String getLoginSuccessResponse(HttpSession session,String responseType){
  StringBuffer sb=new StringBuffer();
  int inactiveInterval=session.getMaxInactiveInterval();
  if (BaseCmd.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
    sb.append("String_Node_Str");
    Enumeration attrNames=session.getAttributeNames();
    if (attrNames != null) {
      sb.append("String_Node_Str" + inactiveInterval + "String_Node_Str");
      while (attrNames.hasMoreElements()) {
        String attrName=(String)attrNames.nextElement();
        Object attrObj=session.getAttribute(attrName);
        if ((attrObj instanceof String) || (attrObj instanceof Long)) {
          sb.append("String_Node_Str" + attrName + "String_Node_Str"+ attrObj.toString()+ "String_Node_Str");
        }
      }
    }
    sb.append("String_Node_Str");
  }
 else {
    sb.append("String_Node_Str");
    sb.append("String_Node_Str" + inactiveInterval + "String_Node_Str");
    Enumeration attrNames=session.getAttributeNames();
    if (attrNames != null) {
      while (attrNames.hasMoreElements()) {
        String attrName=(String)attrNames.nextElement();
        Object attrObj=session.getAttribute(attrName);
        if (attrObj instanceof String || attrObj instanceof Long || attrObj instanceof Short) {
          sb.append("String_Node_Str" + attrName + "String_Node_Str"+ attrObj.toString()+ "String_Node_Str"+ attrName+ "String_Node_Str");
        }
      }
    }
    sb.append("String_Node_Str");
  }
  return sb.toString();
}
Program: 89796
Project: 89796
Buggy source:
@Override public boolean revokePortForwardingRule(long vmId){
  UserVmVO vm=_vmDao.findByIdIncludingRemoved(vmId);
  if (vm == null) {
    return false;
  }
  List<PortForwardingRuleVO> rules=_forwardingDao.listByVm(vmId);
  for (  PortForwardingRuleVO rule : rules) {
    revokePortForwardingRule(rule.getId(),true);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean revokePortForwardingRule(long vmId){
  UserVmVO vm=_vmDao.findByIdIncludingRemoved(vmId);
  if (vm == null) {
    return false;
  }
  List<PortForwardingRuleVO> rules=_forwardingDao.listByVm(vmId);
  if (rules == null || rules.isEmpty()) {
    return true;
  }
  for (  PortForwardingRuleVO rule : rules) {
    revokePortForwardingRule(rule.getId(),true);
  }
  return true;
}
Program: 89798
Project: 89798
Buggy source:
@Override public boolean attachIso(AttachIsoCmd cmd){
  Account account=UserContext.current().getCaller();
  Long userId=UserContext.current().getCallerUserId();
  Long vmId=cmd.getVirtualMachineId();
  Long isoId=cmd.getId();
  UserVmVO vmInstanceCheck=_userVmDao.findById(vmId);
  if (vmInstanceCheck == null) {
    throw new InvalidParameterValueException("String_Node_Str" + vmId);
  }
  VMTemplateVO iso=_tmpltDao.findById(isoId);
  if (iso == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + isoId);
  }
  State vmState=vmInstanceCheck.getState();
  if (vmState != State.Running && vmState != State.Stopped) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  String errMsg="String_Node_Str" + isoId + "String_Node_Str"+ vmId;
  userId=accountAndUserValidation(account,userId,vmInstanceCheck,iso,errMsg);
  VMInstanceVO vm=ApiDBUtils.findVMInstanceById(vmId);
  VMTemplateVO vmTemplate=ApiDBUtils.findTemplateById(vm.getTemplateId());
  if ("String_Node_Str".equals(iso.getDisplayText()) && vmTemplate.getHypervisorType() != Hypervisor.HypervisorType.XenServer) {
    throw new InvalidParameterValueException("String_Node_Str" + vmTemplate.getHypervisorType());
  }
  return attachISOToVM(vmId,userId,isoId,true);
}

Fixed version (ground truth):
@Override public boolean attachIso(AttachIsoCmd cmd){
  Account account=UserContext.current().getCaller();
  Long userId=UserContext.current().getCallerUserId();
  Long vmId=cmd.getVirtualMachineId();
  Long isoId=cmd.getId();
  UserVmVO vmInstanceCheck=_userVmDao.findById(vmId);
  if (vmInstanceCheck == null) {
    throw new InvalidParameterValueException("String_Node_Str" + vmId);
  }
  VMTemplateVO iso=_tmpltDao.findById(isoId);
  if (iso == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + isoId);
  }
  State vmState=vmInstanceCheck.getState();
  if (vmState != State.Running && vmState != State.Stopped) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  String errMsg="String_Node_Str" + isoId + "String_Node_Str"+ vmId;
  userId=accountAndUserValidation(account,userId,vmInstanceCheck,iso,errMsg);
  if ("String_Node_Str".equals(iso.getDisplayText()) && vmInstanceCheck.getHypervisorType() != Hypervisor.HypervisorType.XenServer) {
    throw new InvalidParameterValueException("String_Node_Str" + vmInstanceCheck.getHypervisorType());
  }
  return attachISOToVM(vmId,userId,isoId,true);
}
Program: 89800
Project: 89800
Buggy source:
public static DomainVO findDomainById(Long domainId){
  return _domainDao.findById(domainId);
}

Fixed version (ground truth):
public static DomainVO findDomainById(Long domainId){
  return _domainDao.findByIdIncludingRemoved(domainId);
}
Program: 89801
Project: 89801
Buggy source:
public static HostVO findHostById(Long hostId){
  return _hostDao.findById(hostId);
}

Fixed version (ground truth):
public static HostVO findHostById(Long hostId){
  return _hostDao.findByIdIncludingRemoved(hostId);
}
Program: 89802
Project: 89802
Buggy source:
public static GuestOS findGuestOSById(Long id){
  return _guestOSDao.findById(id);
}

Fixed version (ground truth):
public static GuestOS findGuestOSById(Long id){
  return _guestOSDao.findByIdIncludingRemoved(id);
}
Program: 89803
Project: 89803
Buggy source:
public static DomainRouterVO findDomainRouterById(Long routerId){
  return _domainRouterDao.findById(routerId);
}

Fixed version (ground truth):
public static DomainRouterVO findDomainRouterById(Long routerId){
  return _domainRouterDao.findByIdIncludingRemoved(routerId);
}
Program: 89805
Project: 89805
Buggy source:
@Override @DB public void cleanupVolumes(long vmId) throws ConcurrentOperationException {
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vmId);
  }
  List<VolumeVO> volumesForVm=_volsDao.findByInstance(vmId);
  List<VolumeVO> toBeExpunged=new ArrayList<VolumeVO>();
  Transaction txn=Transaction.currentTxn();
  txn.start();
  for (  VolumeVO vol : volumesForVm) {
    if (vol.getVolumeType().equals(VolumeType.ROOT)) {
      if (!vol.getState().equals(Volume.State.Destroy))       destroyVolume(vol);
      toBeExpunged.add(vol);
    }
 else {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + vol);
      }
      _volsDao.detachVolume(vol.getId());
    }
  }
  txn.commit();
  for (  VolumeVO expunge : toBeExpunged) {
    expungeVolume(expunge);
  }
}

Fixed version (ground truth):
@Override @DB public void cleanupVolumes(long vmId) throws ConcurrentOperationException {
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vmId);
  }
  List<VolumeVO> volumesForVm=_volsDao.findByInstance(vmId);
  List<VolumeVO> toBeExpunged=new ArrayList<VolumeVO>();
  Transaction txn=Transaction.currentTxn();
  txn.start();
  for (  VolumeVO vol : volumesForVm) {
    if (vol.getVolumeType().equals(VolumeType.ROOT)) {
      if (!vol.getState().equals(Volume.State.Destroy)) {
        destroyVolume(vol);
        VMInstanceVO vm=_vmInstanceDao.findById(vmId);
        if (vm.getType() == VirtualMachine.Type.User) {
          UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_DELETE,vol.getAccountId(),vol.getDataCenterId(),vol.getId(),vol.getName(),null,null,null);
          _usageEventDao.persist(usageEvent);
        }
      }
      toBeExpunged.add(vol);
    }
 else {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + vol);
      }
      _volsDao.detachVolume(vol.getId());
    }
  }
  txn.commit();
  for (  VolumeVO expunge : toBeExpunged) {
    expungeVolume(expunge);
  }
}
Program: 89806
Project: 89806
Buggy source:
@Override @DB public void destroyVolume(VolumeVO volume) throws ConcurrentOperationException {
  Transaction txn=Transaction.currentTxn();
  txn.start();
  _volsDao.update(volume,Volume.Event.Destroy);
  long volumeId=volume.getId();
  if (volume.getPoolId() != null) {
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_DELETE,volume.getAccountId(),volume.getDataCenterId(),volumeId,volume.getName(),null,null,null);
    _usageEventDao.persist(usageEvent);
  }
  _snapshotMgr.deletePoliciesForVolume(volumeId);
  _accountMgr.decrementResourceCount(volume.getAccountId(),ResourceType.volume);
  txn.commit();
}

Fixed version (ground truth):
@Override @DB public void destroyVolume(VolumeVO volume) throws ConcurrentOperationException {
  Transaction txn=Transaction.currentTxn();
  txn.start();
  _volsDao.update(volume,Volume.Event.Destroy);
  long volumeId=volume.getId();
  _snapshotMgr.deletePoliciesForVolume(volumeId);
  _accountMgr.decrementResourceCount(volume.getAccountId(),ResourceType.volume);
  txn.commit();
}
Program: 89808
Project: 89808
Buggy source:
@Override public UserVm destroyVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException {
  Account account=UserContext.current().getCaller();
  Long userId=UserContext.current().getCallerUserId();
  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;
  try {
    status=_itMgr.destroy(vm,caller,account);
  }
 catch (  OperationTimedoutException e) {
    throw new CloudRuntimeException("String_Node_Str" + vm,e);
  }
  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);
  }
}

Fixed version (ground truth):
@Override public UserVm destroyVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException {
  Account account=UserContext.current().getCaller();
  Long userId=UserContext.current().getCallerUserId();
  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;
  try {
    status=_itMgr.destroy(vm,caller,account);
  }
 catch (  OperationTimedoutException e) {
    throw new CloudRuntimeException("String_Node_Str" + vm,e);
  }
  if (status) {
    List<VolumeVO> volumes=_volsDao.findByInstance(vmId);
    for (    VolumeVO volume : volumes) {
      if (volume.getVolumeType().equals(VolumeType.ROOT)) {
        UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_DELETE,volume.getAccountId(),volume.getDataCenterId(),volume.getId(),volume.getName(),null,null,null);
        _usageEventDao.persist(usageEvent);
      }
    }
    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: 89810
Project: 89810
Buggy source:
private void updateVmStateForFailedVmCreation(Long vmId){
  UserVmVO vm=_vmDao.findById(vmId);
  if (vm != null) {
    if (vm.getState().equals(State.Stopped)) {
      _itMgr.stateTransitTo(vm,VirtualMachine.Event.OperationFailed,null);
      List<VolumeVO> volumesForThisVm=_volsDao.findByInstance(vm.getId());
      for (      VolumeVO volume : volumesForThisVm) {
        try {
          _storageMgr.destroyVolume(volume);
        }
 catch (        ConcurrentOperationException e) {
          s_logger.warn("String_Node_Str" + volume.getId() + "String_Node_Str"+ vmId+ "String_Node_Str");
        }
      }
    }
  }
}

Fixed version (ground truth):
private void updateVmStateForFailedVmCreation(Long vmId){
  UserVmVO vm=_vmDao.findById(vmId);
  if (vm != null) {
    if (vm.getState().equals(State.Stopped)) {
      _itMgr.stateTransitTo(vm,VirtualMachine.Event.OperationFailed,null);
      List<VolumeVO> volumesForThisVm=_volsDao.findByInstance(vm.getId());
      for (      VolumeVO volume : volumesForThisVm) {
        try {
          _storageMgr.destroyVolume(volume);
          if ((volume.getStatus() == AsyncInstanceCreateStatus.Created) && (volume.getVolumeType().equals(VolumeType.ROOT))) {
            UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_DELETE,volume.getAccountId(),volume.getDataCenterId(),volume.getId(),volume.getName(),null,null,null);
            _usageEventDao.persist(usageEvent);
          }
        }
 catch (        ConcurrentOperationException e) {
          s_logger.warn("String_Node_Str" + volume.getId() + "String_Node_Str"+ vmId+ "String_Node_Str");
        }
      }
    }
  }
}
Program: 89811
Project: 89811
Buggy source:
@Override public <T extends VMInstanceVO>boolean advanceExpunge(T vm,User caller,Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException {
  if (vm == null || vm.getRemoved() != null) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + vm);
    }
    return true;
  }
  if (!this.advanceStop(vm,false,caller,account)) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str");
    }
  }
  if (!stateTransitTo(vm,VirtualMachine.Event.ExpungeOperation,vm.getHostId())) {
    s_logger.debug("String_Node_Str" + vm.toString());
    return false;
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vm);
  }
  VirtualMachineProfile<T> profile=new VirtualMachineProfileImpl<T>(vm);
  _networkMgr.cleanupNics(profile);
  _storageMgr.cleanupVolumes(vm.getId());
  VirtualMachineGuru<T> guru=getVmGuru(vm);
  guru.finalizeExpunge(vm);
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vm);
  }
  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 true;
}

Fixed version (ground truth):
@Override public <T extends VMInstanceVO>boolean advanceExpunge(T vm,User caller,Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException {
  if (vm == null || vm.getRemoved() != null) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + vm);
    }
    return true;
  }
  if (!this.advanceStop(vm,false,caller,account)) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str");
    }
  }
  if (!stateTransitTo(vm,VirtualMachine.Event.ExpungeOperation,vm.getHostId())) {
    s_logger.debug("String_Node_Str" + vm.toString());
    return false;
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vm);
  }
  VirtualMachineProfile<T> profile=new VirtualMachineProfileImpl<T>(vm);
  _networkMgr.cleanupNics(profile);
  _storageMgr.cleanupVolumes(vm.getId());
  VirtualMachineGuru<T> guru=getVmGuru(vm);
  guru.finalizeExpunge(vm);
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vm);
  }
  return true;
}
Program: 89813
Project: 89813
Buggy source:
private boolean cleanupDomain(Long domainId,Long ownerId) throws ConcurrentOperationException, ResourceUnavailableException {
  boolean success=true;
{
    SearchCriteria<DomainVO> sc=_domainDao.createSearchCriteria();
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,domainId);
    List<DomainVO> domains=_domainDao.search(sc,null);
    for (    DomainVO domain : domains) {
      success=(success && cleanupDomain(domain.getId(),domain.getAccountId()));
    }
  }
{
    SearchCriteria<AccountVO> sc=_accountDao.createSearchCriteria();
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,domainId);
    List<AccountVO> accounts=_accountDao.search(sc,null);
    for (    AccountVO account : accounts) {
      success=(success && _accountMgr.cleanupAccount(account,UserContext.current().getCallerUserId(),UserContext.current().getCaller()));
    }
  }
  boolean deleteDomainSuccess=_domainDao.remove(domainId);
  return success && deleteDomainSuccess;
}

Fixed version (ground truth):
private boolean cleanupDomain(Long domainId,Long ownerId) throws ConcurrentOperationException, ResourceUnavailableException {
  boolean success=true;
{
    SearchCriteria<DomainVO> sc=_domainDao.createSearchCriteria();
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,domainId);
    List<DomainVO> domains=_domainDao.search(sc,null);
    for (    DomainVO domain : domains) {
      success=(success && cleanupDomain(domain.getId(),domain.getAccountId()));
      if (!success) {
        s_logger.warn("String_Node_Str" + domain.getId());
      }
    }
  }
{
    SearchCriteria<AccountVO> sc=_accountDao.createSearchCriteria();
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,domainId);
    List<AccountVO> accounts=_accountDao.search(sc,null);
    for (    AccountVO account : accounts) {
      success=(success && _accountMgr.deleteAccount(account,UserContext.current().getCallerUserId(),UserContext.current().getCaller()));
      if (!success) {
        s_logger.warn("String_Node_Str" + account.getId() + "String_Node_Str");
      }
    }
  }
  boolean deleteDomainSuccess=_domainDao.remove(domainId);
  return success && deleteDomainSuccess;
}
Program: 89816
Project: 89816
Buggy source:
@Override public StartupCommand[] initialize() throws IllegalArgumentException {
  Connection conn=getConnection();
  setupServer(conn);
  if (!getHostInfo(conn)) {
    s_logger.warn("String_Node_Str" + _host.ip);
    return null;
  }
  StartupRoutingCommand cmd=new StartupRoutingCommand();
  fillHostInfo(conn,cmd);
  Map<String,State> changes=null;
synchronized (_vms) {
    _vms.clear();
    changes=sync(conn);
  }
  cmd.setHypervisorType(HypervisorType.XenServer);
  cmd.setChanges(changes);
  cmd.setCluster(_cluster);
  StartupStorageCommand sscmd=initializeLocalSR(conn);
  if (sscmd != null) {
    return new StartupCommand[]{cmd,sscmd};
  }
  return new StartupCommand[]{cmd};
}

Fixed version (ground truth):
@Override public StartupCommand[] initialize() throws IllegalArgumentException {
  Connection conn=getConnection();
  setupServer(conn);
  if (!getHostInfo(conn)) {
    s_logger.warn("String_Node_Str" + _host.ip);
    return null;
  }
  try {
    cleanupHaltedVms(conn);
  }
 catch (  XenAPIException e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
catch (  XmlRpcException e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
  StartupRoutingCommand cmd=new StartupRoutingCommand();
  fillHostInfo(conn,cmd);
  Map<String,State> changes=null;
synchronized (_vms) {
    _vms.clear();
    changes=sync(conn);
  }
  cmd.setHypervisorType(HypervisorType.XenServer);
  cmd.setChanges(changes);
  cmd.setCluster(_cluster);
  StartupStorageCommand sscmd=initializeLocalSR(conn);
  if (sscmd != null) {
    return new StartupCommand[]{cmd,sscmd};
  }
  return new StartupCommand[]{cmd};
}
Program: 89818
Project: 89818
Buggy source:
public SavePasswordCommand(String password,String vmIpAddress,String routerPrivateIpAddress,String vmName){
  this.password=password;
  this.vmIpAddress=vmIpAddress;
  this.routerPrivateIpAddress=routerPrivateIpAddress;
  this.vmName=vmName;
}

Fixed version (ground truth):
public SavePasswordCommand(String password,String vmIpAddress,String vmName){
  this.password=password;
  this.vmIpAddress=vmIpAddress;
  this.vmName=vmName;
}
Program: 89819
Project: 89819
Buggy source:
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
  password=Long.toHexString(_rand.nextLong());
  UserVm result=_userVmService.resetVMPassword(this,password);
  if (result != null) {
    UserVmResponse response=_responseGenerator.createUserVmResponse(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() throws ResourceUnavailableException, InsufficientCapacityException {
  password=_mgr.generateRandomPassword();
  UserVm result=_userVmService.resetVMPassword(this,password);
  if (result != null) {
    UserVmResponse response=_responseGenerator.createUserVmResponse(result);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
  }
 else {
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str");
  }
}
Program: 89820
Project: 89820
Buggy source:
void setParameter(String name,Object value);

Fixed version (ground truth):
void setParameter(Param name,Object value);
Program: 89821
Project: 89821
Buggy source:
/** 
 * @return parameter specific for this type of virtual machine.
 */
Object getParameter(String name);

Fixed version (ground truth):
/** 
 * @return parameter specific for this type of virtual machine.
 */
Object getParameter(Param name);
Program: 89823
Project: 89823
Buggy source:
@Override public boolean finalizeDeployment(Commands cmds,VirtualMachineProfile<ConsoleProxyVO> profile,DeployDestination dest,ReservationContext context){
  NicProfile controlNic=(NicProfile)profile.getParameter("String_Node_Str");
  CheckSshCommand check=new CheckSshCommand(profile.getInstanceName(),controlNic.getIp4Address(),3922,5,20);
  cmds.addCommand("String_Node_Str",check);
  ConsoleProxyVO proxy=profile.getVirtualMachine();
  DataCenter dc=dest.getDataCenter();
  List<NicVO> nics=_nicDao.listBy(proxy.getId());
  for (  NicVO nic : nics) {
    NetworkVO network=_networkDao.findById(nic.getNetworkId());
    if ((network.getTrafficType() == TrafficType.Public && dc.getNetworkType() == NetworkType.Advanced) || (network.getTrafficType() == TrafficType.Guest && dc.getNetworkType() == NetworkType.Basic)) {
      proxy.setPublicIpAddress(nic.getIp4Address());
      proxy.setPublicNetmask(nic.getNetmask());
      proxy.setPublicMacAddress(nic.getMacAddress());
    }
 else     if (network.getTrafficType() == TrafficType.Management) {
      proxy.setPrivateIpAddress(nic.getIp4Address());
      proxy.setPrivateMacAddress(nic.getMacAddress());
    }
  }
  _consoleProxyDao.update(proxy.getId(),proxy);
  return true;
}

Fixed version (ground truth):
@Override public boolean finalizeDeployment(Commands cmds,VirtualMachineProfile<ConsoleProxyVO> profile,DeployDestination dest,ReservationContext context){
  NicProfile controlNic=(NicProfile)profile.getParameter(VirtualMachineProfile.Param.ControlNic);
  CheckSshCommand check=new CheckSshCommand(profile.getInstanceName(),controlNic.getIp4Address(),3922,5,20);
  cmds.addCommand("String_Node_Str",check);
  ConsoleProxyVO proxy=profile.getVirtualMachine();
  DataCenter dc=dest.getDataCenter();
  List<NicVO> nics=_nicDao.listBy(proxy.getId());
  for (  NicVO nic : nics) {
    NetworkVO network=_networkDao.findById(nic.getNetworkId());
    if ((network.getTrafficType() == TrafficType.Public && dc.getNetworkType() == NetworkType.Advanced) || (network.getTrafficType() == TrafficType.Guest && dc.getNetworkType() == NetworkType.Basic)) {
      proxy.setPublicIpAddress(nic.getIp4Address());
      proxy.setPublicNetmask(nic.getNetmask());
      proxy.setPublicMacAddress(nic.getMacAddress());
    }
 else     if (network.getTrafficType() == TrafficType.Management) {
      proxy.setPrivateIpAddress(nic.getIp4Address());
      proxy.setPrivateMacAddress(nic.getMacAddress());
    }
  }
  _consoleProxyDao.update(proxy.getId(),proxy);
  return true;
}
Program: 89826
Project: 89826
Buggy source:
@Override public void execute(){
  try {
    Vlan result=_configService.createVlanAndPublicIpRange(this);
    if (result != null) {
      VlanIpRangeResponse response=_responseGenerator.createVlanIpRangeResponse(result);
      response.setResponseName(getCommandName());
      this.setResponseObject(response);
    }
 else {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  ConcurrentOperationException ex) {
    s_logger.warn("String_Node_Str",ex);
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,ex.getMessage());
  }
catch (  InsufficientCapacityException ex) {
    s_logger.info(ex);
    throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR,ex.getMessage());
  }
}

Fixed version (ground truth):
@Override public void execute() throws ResourceUnavailableException {
  try {
    Vlan result=_configService.createVlanAndPublicIpRange(this);
    if (result != null) {
      VlanIpRangeResponse response=_responseGenerator.createVlanIpRangeResponse(result);
      response.setResponseName(getCommandName());
      this.setResponseObject(response);
    }
 else {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  ConcurrentOperationException ex) {
    s_logger.warn("String_Node_Str",ex);
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,ex.getMessage());
  }
catch (  InsufficientCapacityException ex) {
    s_logger.info(ex);
    throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR,ex.getMessage());
  }
}
Program: 89827
Project: 89827
Buggy source:
/** 
 * Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on the virtual public network (2) pod-wide direct attached VLANs (3) account-specific direct attached VLANs
 * @param userId
 * @param vlanType - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be directly attached to UserVMs)
 * @param zoneId
 * @param accountId
 * @param podId
 * @param add
 * @param vlanId
 * @param gateway
 * @param startIP
 * @param endIP
 * @throws 
     * @return The new Vlan object
 */
Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException ;

Fixed version (ground truth):
/** 
 * Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on the virtual public network (2) pod-wide direct attached VLANs (3) account-specific direct attached VLANs
 * @param userId
 * @param vlanType - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be directly attached to UserVMs)
 * @param zoneId
 * @param accountId
 * @param podId
 * @param add
 * @param vlanId
 * @param gateway
 * @param startIP
 * @param endIP
 * @throws 
     * @return The new Vlan object
 */
Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException, ResourceUnavailableException ;
Program: 89828
Project: 89828
Buggy source:
Vlan createVlanAndPublicIpRange(Long userId,Long zoneId,Long podId,String startIP,String endIP,String vlanGateway,String vlanNetmask,boolean forVirtualNetwork,String vlanId,Account account,Long networkId) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException ;

Fixed version (ground truth):
Vlan createVlanAndPublicIpRange(Long userId,Long zoneId,Long podId,String startIP,String endIP,String vlanGateway,String vlanNetmask,boolean forVirtualNetwork,String vlanId,Account account,Long networkId) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException, ResourceUnavailableException ;
Program: 89830
Project: 89830
Buggy source:
@Override public boolean deleteVlanAndPublicIpRange(long userId,long vlanDbId) throws InvalidParameterValueException {
  VlanVO vlan=_vlanDao.findById(vlanDbId);
  if (vlan == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (_publicIpAddressDao.countIPs(vlan.getDataCenterId(),vlanDbId,true) > 0) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (_domrDao.listByVlanDbId(vlanDbId).size() > 0) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (!deletePublicIPRange(vlanDbId)) {
    return false;
  }
  return _vlanDao.expunge(vlanDbId);
}

Fixed version (ground truth):
@Override public boolean deleteVlanAndPublicIpRange(long userId,long vlanDbId) throws InvalidParameterValueException {
  VlanVO vlan=_vlanDao.findById(vlanDbId);
  if (vlan == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (_publicIpAddressDao.countIPs(vlan.getDataCenterId(),vlanDbId,true) > 0) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (!deletePublicIPRange(vlanDbId)) {
    return false;
  }
  return _vlanDao.expunge(vlanDbId);
}
Program: 89832
Project: 89832
Buggy source:
@Override public <T extends VMInstanceVO>DiskProfile allocateRawVolume(VolumeType type,String name,DiskOfferingVO offering,Long size,T vm,Account owner){
  long userId=UserContext.current().getCallerUserId();
  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);
}

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().getCallerUserId();
  if (size == null) {
    size=offering.getDiskSizeInBytes();
  }
 else {
    size=(size * 1024 * 1024* 1024);
  }
  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: 89835
Project: 89835
Buggy source:
@Override public SecondaryStorageVmVO startSecStorageVm(long secStorageVmId){
  boolean started=false;
  long startEventId=EventUtils.saveStartedEvent(User.UID_SYSTEM,Account.ACCOUNT_ID_SYSTEM,EventTypes.EVENT_SSVM_START,"String_Node_Str" + secStorageVmId);
  try {
    SecondaryStorageVmVO ssvm=start(secStorageVmId);
    started=true;
    return ssvm;
  }
 catch (  StorageUnavailableException e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
catch (  InsufficientCapacityException e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
catch (  ConcurrentOperationException e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
catch (  ResourceUnavailableException e) {
    return null;
  }
 finally {
    if (started) {
      EventUtils.saveEvent(User.UID_SYSTEM,Account.ACCOUNT_ID_SYSTEM,EventVO.LEVEL_INFO,EventTypes.EVENT_SSVM_START,"String_Node_Str" + secStorageVmId,startEventId);
    }
 else {
      EventUtils.saveEvent(User.UID_SYSTEM,Account.ACCOUNT_ID_SYSTEM,EventVO.LEVEL_ERROR,EventTypes.EVENT_SSVM_START,"String_Node_Str" + secStorageVmId,startEventId);
    }
  }
}

Fixed version (ground truth):
@Override public SecondaryStorageVmVO startSecStorageVm(long secStorageVmId){
  boolean started=false;
  long startEventId=EventUtils.saveStartedEvent(User.UID_SYSTEM,Account.ACCOUNT_ID_SYSTEM,EventTypes.EVENT_SSVM_START,"String_Node_Str" + secStorageVmId);
  try {
    SecondaryStorageVmVO ssvm=start(secStorageVmId);
    started=true;
    return ssvm;
  }
 catch (  StorageUnavailableException e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
catch (  InsufficientCapacityException e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
catch (  ConcurrentOperationException e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
catch (  ResourceUnavailableException e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
catch (  Exception e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
 finally {
    if (started) {
      EventUtils.saveEvent(User.UID_SYSTEM,Account.ACCOUNT_ID_SYSTEM,EventVO.LEVEL_INFO,EventTypes.EVENT_SSVM_START,"String_Node_Str" + secStorageVmId,startEventId);
    }
 else {
      EventUtils.saveEvent(User.UID_SYSTEM,Account.ACCOUNT_ID_SYSTEM,EventVO.LEVEL_ERROR,EventTypes.EVENT_SSVM_START,"String_Node_Str" + secStorageVmId,startEventId);
    }
  }
}
Program: 89837
Project: 89837
Buggy source:
private void createVbd(Connect conn,VirtualMachineTO vmSpec,String vmName,LibvirtVMDef vm) throws InternalErrorException, LibvirtException, URISyntaxException {
  for (  VolumeTO volume : vmSpec.getDisks()) {
    String volPath=getVolumePath(conn,volume);
    DiskDef.diskBus diskBusType=getGuestDiskModel(vmSpec.getOs());
    DiskDef disk=new DiskDef();
    if (volume.getType() == VolumeType.ISO) {
      if (volPath == null) {
        disk.defISODisk(null);
      }
 else {
        disk.defISODisk(volPath);
      }
    }
 else {
      int devId=0;
      if (volume.getType() == VolumeType.ROOT) {
        devId=0;
      }
 else {
        devId=1;
      }
      disk.defFileBasedDisk(volume.getPath(),devId,diskBusType,DiskDef.diskFmtType.QCOW2);
    }
    if (volume.getType() == VolumeType.DATADISK && diskBusType != DiskDef.diskBus.VIRTIO) {
      disk.setAttachDeferred(true);
    }
    if (!disk.isAttachDeferred()) {
      vm.getDevices().addDevice(disk);
    }
  }
  if (vmSpec.getType() != VirtualMachine.Type.User) {
    DiskDef iso=new DiskDef();
    iso.defISODisk(_sysvmISOPath);
    vm.getDevices().addDevice(iso);
    createPatchVbd(conn,vmName,vm,vmSpec);
  }
}

Fixed version (ground truth):
private void createVbd(Connect conn,VirtualMachineTO vmSpec,String vmName,LibvirtVMDef vm) throws InternalErrorException, LibvirtException, URISyntaxException {
  for (  VolumeTO volume : vmSpec.getDisks()) {
    String volPath=getVolumePath(conn,volume);
    DiskDef.diskBus diskBusType=getGuestDiskModel(vmSpec.getOs());
    DiskDef disk=new DiskDef();
    if (volume.getType() == VolumeType.ISO) {
      if (volPath == null) {
        disk.defISODisk(null);
      }
 else {
        disk.defISODisk(volPath);
      }
    }
 else {
      int devId=(int)volume.getDeviceId();
      disk.defFileBasedDisk(volume.getPath(),devId,diskBusType,DiskDef.diskFmtType.QCOW2);
    }
    if (volume.getType() == VolumeType.DATADISK && diskBusType != DiskDef.diskBus.VIRTIO) {
      disk.setAttachDeferred(true);
    }
    if (!disk.isAttachDeferred()) {
      vm.getDevices().addDevice(disk);
    }
  }
  if (vmSpec.getType() != VirtualMachine.Type.User) {
    DiskDef iso=new DiskDef();
    iso.defISODisk(_sysvmISOPath);
    vm.getDevices().addDevice(iso);
    createPatchVbd(conn,vmName,vm,vmSpec);
  }
}
Program: 89838
Project: 89838
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: 89840
Project: 89840
Buggy source:
@Override public void run(){
  try {
    List<Long> shutdownList=new ArrayList<Long>();
    long currentTime=System.currentTimeMillis() >> 10;
    HashMap<Long,Long> stillFree=new HashMap<Long,Long>();
    List<Long> networkIds=_networksDao.findNetworksToGarbageCollect();
    for (    Long networkId : networkIds) {
      Long time=_lastNetworkIdsToFree.remove(networkId);
      if (time == null) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + networkId + "String_Node_Str"+ currentTime);
        }
        stillFree.put(networkId,currentTime);
      }
 else       if (time < (currentTime + _networkGcWait)) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + networkId + "String_Node_Str"+ time);
        }
        stillFree.put(networkId,time);
      }
 else {
        shutdownList.add(networkId);
      }
    }
    _lastNetworkIdsToFree=stillFree;
    for (    Long networkId : shutdownList) {
      try {
        shutdownNetwork(networkId);
      }
 catch (      Exception e) {
        s_logger.warn("String_Node_Str" + networkId);
      }
    }
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    List<Long> shutdownList=new ArrayList<Long>();
    long currentTime=System.currentTimeMillis() >> 10;
    HashMap<Long,Long> stillFree=new HashMap<Long,Long>();
    List<Long> networkIds=_networksDao.findNetworksToGarbageCollect();
    for (    Long networkId : networkIds) {
      Long time=_lastNetworkIdsToFree.remove(networkId);
      if (time == null) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + networkId + "String_Node_Str"+ currentTime);
        }
        stillFree.put(networkId,currentTime);
      }
 else       if (time > (currentTime - _networkGcWait)) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + networkId + "String_Node_Str"+ time);
        }
        stillFree.put(networkId,time);
      }
 else {
        shutdownList.add(networkId);
      }
    }
    _lastNetworkIdsToFree=stillFree;
    for (    Long networkId : shutdownList) {
      try {
        shutdownNetwork(networkId);
      }
 catch (      Exception e) {
        s_logger.warn("String_Node_Str" + networkId);
      }
    }
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str",e);
  }
}
Program: 89842
Project: 89842
Buggy source:
@Override public void destroy(Network network,NetworkOffering offering){
  _dcDao.releaseVnet(network.getBroadcastUri().getHost(),network.getDataCenterId(),network.getAccountId(),network.getReservationId());
}

Fixed version (ground truth):
@Override public void destroy(Network network,NetworkOffering offering){
  s_logger.debug("String_Node_Str" + network.getId());
  _dcDao.releaseVnet(network.getBroadcastUri().getHost(),network.getDataCenterId(),network.getAccountId(),network.getReservationId());
  _networkMgr.resetBroadcastUri(network.getId());
}