nus-yam/ex-repair huggingface dataset:
Program: 107168
Project: 107168
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: 107169
Project: 107169
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: 107170
Project: 107170
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: 107172
Project: 107172
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: 107173
Project: 107173
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: 107175
Project: 107175
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: 107176
Project: 107176
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: 107178
Project: 107178
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: 107180
Project: 107180
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: 107181
Project: 107181
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: 107182
Project: 107182
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: 107183
Project: 107183
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: 107184
Project: 107184
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: 107185
Project: 107185
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: 107186
Project: 107186
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: 107188
Project: 107188
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: 107191
Project: 107191
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: 107194
Project: 107194
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: 107196
Project: 107196
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: 107197
Project: 107197
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: 107198
Project: 107198
Buggy source:
void setParameter(String name,Object value);

Fixed version (ground truth):
void setParameter(Param name,Object value);
Program: 107199
Project: 107199
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: 107201
Project: 107201
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: 107204
Project: 107204
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: 107205
Project: 107205
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: 107206
Project: 107206
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: 107208
Project: 107208
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: 107210
Project: 107210
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: 107214
Project: 107214
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: 107216
Project: 107216
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: 107218
Project: 107218
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());
}
Program: 107219
Project: 107219
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);
  }
}