nus-yam/ex-repair huggingface dataset:
Program: 105077
Project: 105077
Buggy source:
@Test public void moveNetworkAclRuleToNewPositionTestMoveBetweenAclRules(){
  configureNextAndPreviousAclRuleUuidsForMoveAclRuleCommand(nextAclRuleUuid,previousAclRuleUuid);
  Mockito.doNothing().when(networkAclServiceImpl).validateMoveAclRulesData(aclRuleBeingMovedMock,previousAclRuleMock,nextAclRuleMock);
  Mockito.doReturn(aclRuleBeingMovedMock).when(networkAclItemDaoMock).findByUuid(uuidAclRuleBeingMoved);
  Mockito.doReturn(previousAclRuleMock).when(networkAclServiceImpl).retrieveAndValidateAclRule(previousAclRuleUuid);
  Mockito.doReturn(nextAclRuleMock).when(networkAclServiceImpl).retrieveAndValidateAclRule(nextAclRuleUuid);
  configureMoveMethodsToDoNothing();
  networkAclServiceImpl.moveNetworkAclRuleToNewPosition(moveNetworkAclItemCmdMock);
  Mockito.verify(networkAclServiceImpl,Mockito.times(0)).moveRuleToTheTop(Mockito.eq(aclRuleBeingMovedMock),Mockito.anyListOf(NetworkACLItemVO.class));
  Mockito.verify(networkAclServiceImpl,Mockito.times(0)).moveRuleToTheBottom(Mockito.eq(aclRuleBeingMovedMock),Mockito.anyListOf(NetworkACLItemVO.class));
  Mockito.verify(networkAclServiceImpl,Mockito.times(1)).moveRuleBetweenAclRules(Mockito.eq(aclRuleBeingMovedMock),Mockito.anyListOf(NetworkACLItemVO.class),Mockito.eq(previousAclRuleMock),Mockito.eq(nextAclRuleMock));
}

Fixed version (ground truth):
@Test public void moveNetworkAclRuleToNewPositionTestMoveBetweenAclRules(){
  configureNextAndPreviousAclRuleUuidsForMoveAclRuleCommand(nextAclRuleUuid,previousAclRuleUuid);
  Mockito.doNothing().when(networkAclServiceImpl).validateMoveAclRulesData(aclRuleBeingMovedMock,previousAclRuleMock,nextAclRuleMock);
  Mockito.doReturn(aclRuleBeingMovedMock).when(networkAclItemDaoMock).findByUuid(uuidAclRuleBeingMoved);
  Mockito.doReturn(previousAclRuleMock).when(networkAclServiceImpl).retrieveAndValidateAclRule(previousAclRuleUuid);
  Mockito.doReturn(nextAclRuleMock).when(networkAclServiceImpl).retrieveAndValidateAclRule(nextAclRuleUuid);
  configureMoveMethodsToDoNothing();
  networkAclServiceImpl.moveNetworkAclRuleToNewPosition(moveNetworkAclItemCmdMock);
  Mockito.verify(networkAclServiceImpl,Mockito.times(0)).moveRuleToTheTop(Mockito.eq(aclRuleBeingMovedMock),Mockito.anyListOf(NetworkACLItemVO.class));
  Mockito.verify(networkAclServiceImpl,Mockito.times(0)).moveRuleToTheBottom(Mockito.eq(aclRuleBeingMovedMock),Mockito.anyListOf(NetworkACLItemVO.class));
  Mockito.verify(networkAclServiceImpl,Mockito.times(1)).moveRuleBetweenAclRules(Mockito.eq(aclRuleBeingMovedMock),Mockito.anyListOf(NetworkACLItemVO.class),Mockito.eq(previousAclRuleMock),Mockito.eq(nextAclRuleMock));
  Mockito.verify(networkAclServiceImpl,Mockito.times(1)).validateAclConsistency(Mockito.any(MoveNetworkAclItemCmd.class),Mockito.any(NetworkACLVO.class),Mockito.anyListOf(NetworkACLItemVO.class));
}
Program: 105078
Project: 105078
Buggy source:
@Override public boolean savePassword(final Network network,final NicProfile nic,final VirtualMachineProfile vm) throws ResourceUnavailableException {
  if (vm != null && vm.getVirtualMachine().getState().equals(VirtualMachine.State.Running)) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  return canHandle(network.getTrafficType());
}

Fixed version (ground truth):
@Override public boolean savePassword(final Network network,final NicProfile nic,final VirtualMachineProfile vm) throws ResourceUnavailableException {
  if (vm != null && vm.getVirtualMachine().getState().equals(VirtualMachine.State.Running)) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  final boolean canHandle=canHandle(network.getTrafficType());
  if (canHandle) {
    storePasswordInVmDetails(vm);
  }
  return canHandle;
}
Program: 105079
Project: 105079
Buggy source:
@Override public boolean saveSSHKey(final Network network,final NicProfile nic,final VirtualMachineProfile vm,final String sshPublicKey) throws ResourceUnavailableException {
  if (vm != null && vm.getVirtualMachine().getState().equals(VirtualMachine.State.Running)) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  return canHandle(network.getTrafficType());
}

Fixed version (ground truth):
@Override public boolean saveSSHKey(final Network network,final NicProfile nic,final VirtualMachineProfile vm,final String sshPublicKey) throws ResourceUnavailableException {
  if (vm != null && vm.getVirtualMachine().getState().equals(VirtualMachine.State.Running)) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  final boolean canHandle=canHandle(network.getTrafficType());
  if (canHandle) {
    storePasswordInVmDetails(vm);
  }
  return canHandle;
}
Program: 105081
Project: 105081
Buggy source:
@Test public void testVmSnapshotDetails(){
  VMSnapshotDetailsVO detailsVO=new VMSnapshotDetailsVO(1L,"String_Node_Str","String_Node_Str",display);
  vmsnapshotDetailsDao.persist(detailsVO);
  Map<String,String> details=vmsnapshotDetailsDao.listDetailsKeyPairs(1L);
  Assert.assertTrue(details.containsKey("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testVmSnapshotDetails(){
  VMSnapshotDetailsVO detailsVO=new VMSnapshotDetailsVO(1L,"String_Node_Str","String_Node_Str",true);
  vmsnapshotDetailsDao.persist(detailsVO);
  Map<String,String> details=vmsnapshotDetailsDao.listDetailsKeyPairs(1L);
  Assert.assertTrue(details.containsKey("String_Node_Str"));
}
Program: 105083
Project: 105083
Buggy source:
private SnapshotVO createSnapshotInDb(VolumeInfo volume){
  Snapshot.Type snapshotType=Snapshot.Type.MANUAL;
  SnapshotVO snapshotVO=new SnapshotVO(volume.getDataCenterId(),2,1,volume.getId(),1L,UUID.randomUUID().toString(),(short)snapshotType.ordinal(),snapshotType.name(),volume.getSize(),HypervisorType.XenServer);
  return this.snapshotDao.persist(snapshotVO);
}

Fixed version (ground truth):
private SnapshotVO createSnapshotInDb(VolumeInfo volume){
  Snapshot.Type snapshotType=Snapshot.Type.MANUAL;
  SnapshotVO snapshotVO=new SnapshotVO(volume.getDataCenterId(),2,1,volume.getId(),1L,UUID.randomUUID().toString(),(short)snapshotType.ordinal(),snapshotType.name(),volume.getSize(),1L,100L,HypervisorType.XenServer,LocationType.PRIMARY);
  return this.snapshotDao.persist(snapshotVO);
}
Program: 105084
Project: 105084
Buggy source:
private VolumeVO createVolume(Long templateId,long dataStoreId){
  VolumeVO volume=new VolumeVO(Volume.Type.DATADISK,UUID.randomUUID().toString(),this.dcId,1L,1L,1L,1000,0L,0L,"String_Node_Str");
  volume.setDataCenterId(this.dcId);
  volume.setPoolId(dataStoreId);
  volume=volumeDao.persist(volume);
  return volume;
}

Fixed version (ground truth):
private VolumeVO createVolume(Long templateId,long dataStoreId){
  VolumeVO volume=new VolumeVO(Volume.Type.DATADISK,UUID.randomUUID().toString(),this.dcId,1L,1L,1L,Storage.ProvisioningType.THIN,1000,0L,0L,"String_Node_Str");
  volume.setDataCenterId(this.dcId);
  volume.setPoolId(dataStoreId);
  volume=volumeDao.persist(volume);
  return volume;
}
Program: 105086
Project: 105086
Buggy source:
/** 
 * Give hypervisor guru opportunity to decide if certain command needs to be delegated to other host, mainly to secondary storage VM host
 * @param hostId original hypervisor host
 * @param cmd command that is going to be sent, hypervisor guru usually needs to register various context objects into the command object
 * @return delegated host id if the command will be delegated
 */
Pair<Boolean,Long> getCommandHostDelegation(long hostId,Command cmd);

Fixed version (ground truth):
/** 
 * Gives hypervisor guru opportunity to decide if certain commands need to be delegated to another host, for instance, we may have the opportunity to change from a system VM (is considered a host) to a real host to execute commands.
 * @param hostId original hypervisor host
 * @param cmd command that is going to be sent, hypervisor guru usually needs to register various context objects into the command object
 * @return delegated host id if the command will be delegated
 */
Pair<Boolean,Long> getCommandHostDelegation(long hostId,Command cmd);
Program: 105087
Project: 105087
Buggy source:
/** 
 * @param type
 * @param clusterId
 * @param podId
 * @param dcId
 * @param haTag TODO
 * @return
 */
List<HostVO> listAllUpAndEnabledNonHAHosts(Type type,Long clusterId,Long podId,long dcId,String haTag);

Fixed version (ground truth):
List<HostVO> listAllUpAndEnabledNonHAHosts(Type type,Long clusterId,Long podId,long dcId,String haTag);
Program: 105088
Project: 105088
Buggy source:
private boolean canOwnCluster(long clusterId){
  SearchCriteria<HostVO> sc=HostsInClusterSearch.create();
  sc.setParameters("String_Node_Str",clusterId);
  List<HostVO> hosts=search(sc,null);
  boolean ownCluster=(hosts == null || hosts.size() == 0);
  return ownCluster;
}

Fixed version (ground truth):
/** 
 * This determines if hosts belonging to cluster(@clusterId) are up for grabs This is used for handling following cases: 1. First host added in cluster 2. During MS restart all hosts in a cluster are without any MS
 */
private boolean canOwnCluster(long clusterId){
  SearchCriteria<HostVO> sc=HostsInClusterSearch.create();
  sc.setParameters("String_Node_Str",clusterId);
  List<HostVO> hosts=search(sc,null);
  boolean ownCluster=(hosts == null || hosts.size() == 0);
  return ownCluster;
}
Program: 105090
Project: 105090
Buggy source:
@Override public void doInTransactionWithoutResult(TransactionStatus status){
  for (  ResourceTag tagToRemove : tagsToRemove) {
    _resourceTagDao.remove(tagToRemove.getId());
    s_logger.debug("String_Node_Str" + tagToRemove);
  }
}

Fixed version (ground truth):
@Override public void doInTransactionWithoutResult(TransactionStatus status){
  for (  ResourceTag tagToRemove : tagsToDelete) {
    _resourceTagDao.remove(tagToRemove.getId());
    s_logger.debug("String_Node_Str" + tagToRemove + "String_Node_Str"+ String.join("String_Node_Str",resourceIds)+ "String_Node_Str");
  }
}
Program: 105093
Project: 105093
Buggy source:
@Override public List<? extends ResourceTag> listByResourceTypeAndId(ResourceObjectType type,long resourceId){
  return _resourceTagDao.listBy(resourceId,type);
}

Fixed version (ground truth):
@Override public List<? extends ResourceTag> listByResourceTypeAndId(ResourceObjectType resourceType,long resourceId){
  return _resourceTagDao.listBy(resourceId,resourceType);
}
Program: 105095
Project: 105095
Buggy source:
private PDU createPDU(SnmpTrapInfo snmpTrapInfo){
  PDU trap=new PDU();
  trap.setType(PDU.TRAP);
  int alertType=snmpTrapInfo.getAlertType() + 1;
  if (alertType > 0) {
    trap.add(new VariableBinding(SnmpConstants.snmpTrapOID,getOID(CsSnmpConstants.TRAPS_PREFIX + alertType)));
    if (snmpTrapInfo.getDataCenterId() != 0) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.DATA_CENTER_ID),new UnsignedInteger32(snmpTrapInfo.getDataCenterId())));
    }
    if (snmpTrapInfo.getPodId() != 0) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.POD_ID),new UnsignedInteger32(snmpTrapInfo.getPodId())));
    }
    if (snmpTrapInfo.getClusterId() != 0) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.CLUSTER_ID),new UnsignedInteger32(snmpTrapInfo.getClusterId())));
    }
    if (snmpTrapInfo.getMessage() != null) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.MESSAGE),new OctetString(snmpTrapInfo.getMessage())));
    }
 else {
      throw new CloudRuntimeException("String_Node_Str");
    }
    if (snmpTrapInfo.getGenerationTime() != null) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME),new OctetString(snmpTrapInfo.getGenerationTime().toString())));
    }
 else {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME)));
    }
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
  return trap;
}

Fixed version (ground truth):
private PDU createPDU(SnmpTrapInfo snmpTrapInfo){
  PDU trap=new PDU();
  trap.setType(PDU.TRAP);
  int alertType=snmpTrapInfo.getAlertType() + 1;
  if (alertType > 0) {
    long sysUpTimeTicks=ManagementFactory.getRuntimeMXBean().getUptime() / 10;
    trap.add(new VariableBinding(SnmpConstants.sysUpTime,new TimeTicks(sysUpTimeTicks)));
    trap.add(new VariableBinding(SnmpConstants.snmpTrapOID,getOID(CsSnmpConstants.TRAPS_PREFIX + alertType)));
    if (snmpTrapInfo.getDataCenterId() != 0) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.DATA_CENTER_ID),new UnsignedInteger32(snmpTrapInfo.getDataCenterId())));
    }
    if (snmpTrapInfo.getPodId() != 0) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.POD_ID),new UnsignedInteger32(snmpTrapInfo.getPodId())));
    }
    if (snmpTrapInfo.getClusterId() != 0) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.CLUSTER_ID),new UnsignedInteger32(snmpTrapInfo.getClusterId())));
    }
    if (snmpTrapInfo.getMessage() != null) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.MESSAGE),new OctetString(snmpTrapInfo.getMessage())));
    }
 else {
      throw new CloudRuntimeException("String_Node_Str");
    }
    if (snmpTrapInfo.getGenerationTime() != null) {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME),new OctetString(snmpTrapInfo.getGenerationTime().toString())));
    }
 else {
      trap.add(new VariableBinding(getOID(CsSnmpConstants.GENERATION_TIME)));
    }
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
  return trap;
}
Program: 105096
Project: 105096
Buggy source:
@ReflectionUse private Pair<JobInfo.Status,String> orchestrateStop(final VmWorkStop work) throws Exception {
}

Fixed version (ground truth):
@ReflectionUse private Pair<JobInfo.Status,String> orchestrateStop(final VmWorkStop work) throws Exception {
  final VMInstanceVO vm=_entityMgr.findById(VMInstanceVO.class,work.getVmId());
  if (vm == null) {
    s_logger.info("String_Node_Str" + work.getVmId());
    throw new CloudRuntimeException("String_Node_Str" + work.getVmId());
  }
  orchestrateStop(vm.getUuid(),work.isCleanup());
  return new Pair<JobInfo.Status,String>(JobInfo.Status.SUCCEEDED,null);
}
Program: 105097
Project: 105097
Buggy source:
@Override public long getEntityOwnerId(){
  Long accountId=_accountService.getActiveAccountByName(accountName,domainId).getAccountId();
  if (accountId == null) {
    return CallContext.current().getCallingAccount().getId();
  }
  return Account.ACCOUNT_ID_SYSTEM;
}

Fixed version (ground truth):
@Override public long getEntityOwnerId(){
  Account activeAccountByName=_accountService.getActiveAccountByName(accountName,domainId);
  if (activeAccountByName != null) {
    return activeAccountByName.getAccountId();
  }
  return Account.ACCOUNT_ID_SYSTEM;
}
Program: 105105
Project: 105105
Buggy source:
@Test public void testGetDifferenceDays(){
  Date now=new Date();
  assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now,now) == 0L);
  assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now,new DateTime(now).plusDays(1).toDate()) == 1L);
}

Fixed version (ground truth):
@Test public void testGetDifferenceDays(){
  Date now=new Date();
  assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now,now) == 0L);
  Calendar c=Calendar.getInstance();
  c.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  Calendar c2=(Calendar)c.clone();
  c2.add(Calendar.DATE,1);
  assertEquals(1L,QuotaAlertManagerImpl.getDifferenceDays(c.getTime(),c2.getTime()));
}
Program: 105106
Project: 105106
Buggy source:
public Void deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl,CommandResult> callback,DeleteVolumeContext<VolumeApiResult> context){
  CommandResult result=callback.getResult();
  VolumeObject vo=context.getVolume();
  VolumeApiResult apiResult=new VolumeApiResult(vo);
  try {
    if (result.isSuccess()) {
      vo.processEvent(Event.OperationSuccessed);
      if (canVolumeBeRemoved(vo.getId())) {
        s_logger.info("String_Node_Str" + vo.getId() + "String_Node_Str");
        volDao.remove(vo.getId());
      }
      SnapshotDataStoreVO snapStoreVo=_snapshotStoreDao.findByVolume(vo.getId(),DataStoreRole.Primary);
      if (snapStoreVo != null) {
        _snapshotStoreDao.remove(snapStoreVo.getId());
      }
    }
 else {
      vo.processEvent(Event.OperationFailed);
      apiResult.setResult(result.getResult());
    }
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
  }
  context.getFuture().complete(apiResult);
  return null;
}

Fixed version (ground truth):
public Void deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl,CommandResult> callback,DeleteVolumeContext<VolumeApiResult> context){
  CommandResult result=callback.getResult();
  VolumeObject vo=context.getVolume();
  VolumeApiResult apiResult=new VolumeApiResult(vo);
  try {
    if (result.isSuccess()) {
      vo.processEvent(Event.OperationSuccessed);
      if (canVolumeBeRemoved(vo.getId())) {
        s_logger.info("String_Node_Str" + vo.getId() + "String_Node_Str");
        volDao.remove(vo.getId());
      }
      SnapshotDataStoreVO snapStoreVo=_snapshotStoreDao.findByVolume(vo.getId(),DataStoreRole.Primary);
      if (snapStoreVo != null) {
        long storagePoolId=snapStoreVo.getDataStoreId();
        StoragePoolVO storagePoolVO=storagePoolDao.findById(storagePoolId);
        if (storagePoolVO.isManaged()) {
          DataStore primaryDataStore=dataStoreMgr.getPrimaryDataStore(storagePoolId);
          Map<String,String> mapCapabilities=primaryDataStore.getDriver().getCapabilities();
          String value=mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
          Boolean supportsStorageSystemSnapshots=new Boolean(value);
          if (!supportsStorageSystemSnapshots) {
            _snapshotStoreDao.remove(snapStoreVo.getId());
          }
        }
 else {
          _snapshotStoreDao.remove(snapStoreVo.getId());
        }
      }
    }
 else {
      vo.processEvent(Event.OperationFailed);
      apiResult.setResult(result.getResult());
    }
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
  }
  context.getFuture().complete(apiResult);
  return null;
}
Program: 105107
Project: 105107
Buggy source:
public String stopVM(final Connect conn,final String vmName,final boolean forceStop){
  DomainState state=null;
  Domain dm=null;
  s_logger.debug("String_Node_Str");
  if (forceStop) {
    return stopVMInternal(conn,vmName,true);
  }
  String ret=stopVM(conn,vmName,false);
  if (ret == Script.ERR_TIMEOUT) {
    ret=stopVMInternal(conn,vmName,true);
  }
 else   if (ret != null) {
    for (int i=0; i < 3; i++) {
      try {
        dm=conn.domainLookupByName(vmName);
        state=dm.getInfo().state;
        break;
      }
 catch (      final LibvirtException e) {
        s_logger.debug("String_Node_Str" + e.getMessage());
      }
 finally {
        try {
          if (dm != null) {
            dm.free();
          }
        }
 catch (        final LibvirtException l) {
          s_logger.trace("String_Node_Str",l);
        }
      }
    }
    if (state == null) {
      s_logger.debug("String_Node_Str");
      return null;
    }
    if (state != DomainState.VIR_DOMAIN_SHUTOFF) {
      s_logger.debug("String_Node_Str");
      ret=stopVMInternal(conn,vmName,true);
      if (ret != null) {
        return ret;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public String stopVM(final Connect conn,final String vmName,final boolean forceStop){
  DomainState state=null;
  Domain dm=null;
  s_logger.debug("String_Node_Str");
  if (forceStop) {
    return stopVMInternal(conn,vmName,true);
  }
  String ret=stopVMInternal(conn,vmName,false);
  if (ret == Script.ERR_TIMEOUT) {
    ret=stopVMInternal(conn,vmName,true);
  }
 else   if (ret != null) {
    for (int i=0; i < 3; i++) {
      try {
        dm=conn.domainLookupByName(vmName);
        state=dm.getInfo().state;
        break;
      }
 catch (      final LibvirtException e) {
        s_logger.debug("String_Node_Str" + e.getMessage());
      }
 finally {
        try {
          if (dm != null) {
            dm.free();
          }
        }
 catch (        final LibvirtException l) {
          s_logger.trace("String_Node_Str",l);
        }
      }
    }
    if (state == null) {
      s_logger.debug("String_Node_Str");
      return null;
    }
    if (state != DomainState.VIR_DOMAIN_SHUTOFF) {
      s_logger.debug("String_Node_Str");
      ret=stopVMInternal(conn,vmName,true);
      if (ret != null) {
        return ret;
      }
    }
  }
  return null;
}
Program: 105108
Project: 105108
Buggy source:
public void setCpuMaxDeviation(final Double maxCpuDeviation,final Double totalCpuUsed,final Long totalHosts){
  if (maxCpuDeviation != null && totalCpuUsed != null && totalHosts != null && totalHosts != 0) {
    final Double averageCpuUsage=totalCpuUsed / totalHosts;
    this.cpuMaxDeviation=String.format("String_Node_Str",(maxCpuDeviation - averageCpuUsage) * 100.0 / averageCpuUsage);
  }
}

Fixed version (ground truth):
public void setCpuMaxDeviation(final Double maxCpuUsagePercentage,final Double totalCpuUsedPercentage,final Long totalHosts){
  if (maxCpuUsagePercentage != null && totalCpuUsedPercentage != null && totalHosts != null && totalHosts != 0) {
    final Double averageCpuUsagePercentage=totalCpuUsedPercentage / totalHosts;
    this.cpuMaxDeviation=String.format("String_Node_Str",(maxCpuUsagePercentage - averageCpuUsagePercentage) / averageCpuUsagePercentage);
  }
}
Program: 105109
Project: 105109
Buggy source:
public void setCpuMaxDeviation(final Double maxCpuDeviation,final Double totalCpuUsed,final Long totalHosts){
  if (maxCpuDeviation != null && totalCpuUsed != null && totalHosts != null && totalHosts != 0) {
    final Double averageCpuUsage=totalCpuUsed / totalHosts;
    this.cpuMaxDeviation=String.format("String_Node_Str",(maxCpuDeviation - averageCpuUsage) * 100.0 / averageCpuUsage);
  }
}

Fixed version (ground truth):
public void setCpuMaxDeviation(final Double maxCpuUsagePercentage,final Double totalCpuUsedPercentage,final Long totalHosts){
  if (maxCpuUsagePercentage != null && totalCpuUsedPercentage != null && totalHosts != null && totalHosts != 0) {
    final Double averageCpuUsagePercentage=totalCpuUsedPercentage / totalHosts;
    this.cpuMaxDeviation=String.format("String_Node_Str",(maxCpuUsagePercentage - averageCpuUsagePercentage) / averageCpuUsagePercentage);
  }
}
Program: 105113
Project: 105113
Buggy source:
private String getBroadcastUriFromBridge(final String brName){
  final String pif=matchPifFileInDirectory(brName);
  final Pattern pattern=Pattern.compile("String_Node_Str");
  final Matcher matcher=pattern.matcher(pif);
  s_logger.debug("String_Node_Str" + pif + "String_Node_Str"+ brName);
  if (matcher.find()) {
    if (brName.startsWith("String_Node_Str")) {
      return BroadcastDomainType.Vxlan.toUri(matcher.group(2)).toString();
    }
 else {
      if (!matcher.group(4).isEmpty()) {
        return BroadcastDomainType.Vlan.toUri(matcher.group(4)).toString();
      }
 else {
        s_logger.debug("String_Node_Str" + brName + "String_Node_Str"+ pif+ "String_Node_Str");
        return "String_Node_Str";
      }
    }
  }
 else {
    s_logger.debug("String_Node_Str" + brName + "String_Node_Str"+ pif);
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
private String getBroadcastUriFromBridge(final String brName){
  final String pif=matchPifFileInDirectory(brName);
  final Pattern pattern=Pattern.compile("String_Node_Str");
  final Matcher matcher=pattern.matcher(pif);
  s_logger.debug("String_Node_Str" + pif + "String_Node_Str"+ brName);
  if (matcher.find()) {
    if (brName.startsWith("String_Node_Str")) {
      return BroadcastDomainType.Vxlan.toUri(matcher.group(2)).toString();
    }
 else {
      if (!matcher.group(6).isEmpty()) {
        return BroadcastDomainType.Vlan.toUri(matcher.group(6)).toString();
      }
 else       if (!matcher.group(4).isEmpty()) {
        return BroadcastDomainType.Vlan.toUri(matcher.group(4)).toString();
      }
 else {
        s_logger.debug("String_Node_Str" + brName + "String_Node_Str"+ pif+ "String_Node_Str");
        return "String_Node_Str";
      }
    }
  }
 else {
    s_logger.debug("String_Node_Str" + brName + "String_Node_Str"+ pif);
    return "String_Node_Str";
  }
}
Program: 105116
Project: 105116
Buggy source:
boolean applyVpnUsers(long vpnOwnerId,String userName);

Fixed version (ground truth):
boolean applyVpnUsers(long vpnOwnerId,String userName) throws ResourceUnavailableException ;
Program: 105117
Project: 105117
Buggy source:
@Override public void execute(){
  VpnUser vpnUser=_entityMgr.findById(VpnUser.class,getEntityId());
  Account account=_entityMgr.findById(Account.class,vpnUser.getAccountId());
  if (!_ravService.applyVpnUsers(vpnUser.getAccountId(),userName)) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  VpnUsersResponse vpnResponse=new VpnUsersResponse();
  vpnResponse.setId(vpnUser.getUuid());
  vpnResponse.setUserName(vpnUser.getUsername());
  vpnResponse.setAccountName(account.getAccountName());
  Domain domain=_entityMgr.findById(Domain.class,account.getDomainId());
  if (domain != null) {
    vpnResponse.setDomainId(domain.getUuid());
    vpnResponse.setDomainName(domain.getName());
  }
  vpnResponse.setResponseName(getCommandName());
  vpnResponse.setObjectName("String_Node_Str");
  setResponseObject(vpnResponse);
}

Fixed version (ground truth):
@Override public void execute(){
  VpnUser vpnUser=_entityMgr.findById(VpnUser.class,getEntityId());
  Account account=_entityMgr.findById(Account.class,vpnUser.getAccountId());
  try {
    if (!_ravService.applyVpnUsers(vpnUser.getAccountId(),userName)) {
      throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  Exception ex) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  VpnUsersResponse vpnResponse=new VpnUsersResponse();
  vpnResponse.setId(vpnUser.getUuid());
  vpnResponse.setUserName(vpnUser.getUsername());
  vpnResponse.setAccountName(account.getAccountName());
  Domain domain=_entityMgr.findById(Domain.class,account.getDomainId());
  if (domain != null) {
    vpnResponse.setDomainId(domain.getUuid());
    vpnResponse.setDomainName(domain.getName());
  }
  vpnResponse.setResponseName(getCommandName());
  vpnResponse.setObjectName("String_Node_Str");
  setResponseObject(vpnResponse);
}
Program: 105118
Project: 105118
Buggy source:
@Override public void execute(){
  Account owner=_accountService.getAccount(getEntityOwnerId());
  boolean result=_ravService.removeVpnUser(owner.getId(),userName,CallContext.current().getCallingAccount());
  if (!result) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  if (!_ravService.applyVpnUsers(owner.getId(),userName)) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  SuccessResponse response=new SuccessResponse(getCommandName());
  setResponseObject(response);
}

Fixed version (ground truth):
@Override public void execute(){
  Account owner=_accountService.getAccount(getEntityOwnerId());
  boolean result=_ravService.removeVpnUser(owner.getId(),userName,CallContext.current().getCallingAccount());
  if (!result) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  try {
    if (!_ravService.applyVpnUsers(owner.getId(),userName)) {
      throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  Exception ex) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  SuccessResponse response=new SuccessResponse(getCommandName());
  setResponseObject(response);
}
Program: 105120
Project: 105120
Buggy source:
boolean applyVpnUsers(long vpnOwnerId,String userName) throws ResourceUnavailableException ;

Fixed version (ground truth):
boolean applyVpnUsers(long vpnOwnerId,String userName);
Program: 105121
Project: 105121
Buggy source:
@Override public void execute(){
  VpnUser vpnUser=_entityMgr.findById(VpnUser.class,getEntityId());
  Account account=_entityMgr.findById(Account.class,vpnUser.getAccountId());
  try {
    if (!_ravService.applyVpnUsers(vpnUser.getAccountId(),userName)) {
      throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  Exception ex) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  VpnUsersResponse vpnResponse=new VpnUsersResponse();
  vpnResponse.setId(vpnUser.getUuid());
  vpnResponse.setUserName(vpnUser.getUsername());
  vpnResponse.setAccountName(account.getAccountName());
  Domain domain=_entityMgr.findById(Domain.class,account.getDomainId());
  if (domain != null) {
    vpnResponse.setDomainId(domain.getUuid());
    vpnResponse.setDomainName(domain.getName());
  }
  vpnResponse.setResponseName(getCommandName());
  vpnResponse.setObjectName("String_Node_Str");
  setResponseObject(vpnResponse);
}

Fixed version (ground truth):
@Override public void execute(){
  VpnUser vpnUser=_entityMgr.findById(VpnUser.class,getEntityId());
  Account account=_entityMgr.findById(Account.class,vpnUser.getAccountId());
  if (!_ravService.applyVpnUsers(vpnUser.getAccountId(),userName)) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  VpnUsersResponse vpnResponse=new VpnUsersResponse();
  vpnResponse.setId(vpnUser.getUuid());
  vpnResponse.setUserName(vpnUser.getUsername());
  vpnResponse.setAccountName(account.getAccountName());
  Domain domain=_entityMgr.findById(Domain.class,account.getDomainId());
  if (domain != null) {
    vpnResponse.setDomainId(domain.getUuid());
    vpnResponse.setDomainName(domain.getName());
  }
  vpnResponse.setResponseName(getCommandName());
  vpnResponse.setObjectName("String_Node_Str");
  setResponseObject(vpnResponse);
}
Program: 105122
Project: 105122
Buggy source:
@Override public void execute(){
  Account owner=_accountService.getAccount(getEntityOwnerId());
  boolean result=_ravService.removeVpnUser(owner.getId(),userName,CallContext.current().getCallingAccount());
  if (!result) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  try {
    if (!_ravService.applyVpnUsers(owner.getId(),userName)) {
      throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  Exception ex) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  SuccessResponse response=new SuccessResponse(getCommandName());
  setResponseObject(response);
}

Fixed version (ground truth):
@Override public void execute(){
  Account owner=_accountService.getAccount(getEntityOwnerId());
  boolean result=_ravService.removeVpnUser(owner.getId(),userName,CallContext.current().getCallingAccount());
  if (!result) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  if (!_ravService.applyVpnUsers(owner.getId(),userName)) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  SuccessResponse response=new SuccessResponse(getCommandName());
  setResponseObject(response);
}
Program: 105126
Project: 105126
Buggy source:
protected boolean destroySnapshotOnPrimaryStorageExceptThis(final Connection conn,final String volumeUuid,final String avoidSnapshotUuid){
  try {
    final VDI volume=getVDIbyUuid(conn,volumeUuid);
    if (volume == null) {
      throw new InternalErrorException("String_Node_Str" + volumeUuid + "String_Node_Str");
    }
    VDI avoidSnapshot=getVDIbyUuid(conn,avoidSnapshotUuid);
    if (avoidSnapshot == null) {
      throw new InternalErrorException("String_Node_Str" + avoidSnapshotUuid);
    }
    final Set<VDI> snapshots=volume.getSnapshots(conn);
    for (    final VDI snapshot : snapshots) {
      try {
        if (!snapshot.getUuid(conn).equals(avoidSnapshotUuid) && snapshot.getSnapshotTime(conn).before(avoidSnapshot.getSnapshotTime(conn))) {
          snapshot.destroy(conn);
        }
      }
 catch (      final Exception e) {
        final String msg="String_Node_Str" + snapshot + "String_Node_Str"+ e.toString();
        s_logger.warn(msg,e);
      }
    }
    s_logger.debug("String_Node_Str" + volumeUuid + "String_Node_Str"+ avoidSnapshotUuid);
    return true;
  }
 catch (  final XenAPIException e) {
    final String msg="String_Node_Str" + volumeUuid + "String_Node_Str"+ avoidSnapshotUuid+ "String_Node_Str"+ e.toString();
    s_logger.error(msg,e);
  }
catch (  final Exception e) {
    final String msg="String_Node_Str" + volumeUuid + "String_Node_Str"+ avoidSnapshotUuid+ "String_Node_Str"+ e.toString();
    s_logger.warn(msg,e);
  }
  return false;
}

Fixed version (ground truth):
protected boolean destroySnapshotOnPrimaryStorageExceptThis(final Connection conn,final String volumeUuid,final String avoidSnapshotUuid){
  try {
    final VDI volume=getVDIbyUuid(conn,volumeUuid);
    if (volume == null) {
      throw new InternalErrorException("String_Node_Str" + volumeUuid + "String_Node_Str");
    }
    VDI avoidSnapshot=getVDIbyUuid(conn,avoidSnapshotUuid);
    if (avoidSnapshot == null) {
      throw new InternalErrorException("String_Node_Str" + avoidSnapshotUuid);
    }
    final Set<VDI> snapshots=volume.getSnapshots(conn);
    for (    final VDI snapshot : snapshots) {
      try {
        if (!snapshot.getUuid(conn).equals(avoidSnapshotUuid) && snapshot.getSnapshotTime(conn).before(avoidSnapshot.getSnapshotTime(conn)) && snapshot.getVBDs(conn).isEmpty()) {
          snapshot.destroy(conn);
        }
      }
 catch (      final Exception e) {
        final String msg="String_Node_Str" + snapshot + "String_Node_Str"+ e.toString();
        s_logger.warn(msg,e);
      }
    }
    s_logger.debug("String_Node_Str" + volumeUuid + "String_Node_Str"+ avoidSnapshotUuid);
    return true;
  }
 catch (  final XenAPIException e) {
    final String msg="String_Node_Str" + volumeUuid + "String_Node_Str"+ avoidSnapshotUuid+ "String_Node_Str"+ e.toString();
    s_logger.error(msg,e);
  }
catch (  final Exception e) {
    final String msg="String_Node_Str" + volumeUuid + "String_Node_Str"+ avoidSnapshotUuid+ "String_Node_Str"+ e.toString();
    s_logger.warn(msg,e);
  }
  return false;
}
Program: 105131
Project: 105131
Buggy source:
boolean applyVpnUsers(long vpnOwnerId,String userName);

Fixed version (ground truth):
boolean applyVpnUsers(long vpnOwnerId,String userName) throws ResourceUnavailableException ;
Program: 105132
Project: 105132
Buggy source:
@Override public void execute(){
  VpnUser vpnUser=_entityMgr.findById(VpnUser.class,getEntityId());
  Account account=_entityMgr.findById(Account.class,vpnUser.getAccountId());
  if (!_ravService.applyVpnUsers(vpnUser.getAccountId(),userName)) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  VpnUsersResponse vpnResponse=new VpnUsersResponse();
  vpnResponse.setId(vpnUser.getUuid());
  vpnResponse.setUserName(vpnUser.getUsername());
  vpnResponse.setAccountName(account.getAccountName());
  Domain domain=_entityMgr.findById(Domain.class,account.getDomainId());
  if (domain != null) {
    vpnResponse.setDomainId(domain.getUuid());
    vpnResponse.setDomainName(domain.getName());
  }
  vpnResponse.setResponseName(getCommandName());
  vpnResponse.setObjectName("String_Node_Str");
  setResponseObject(vpnResponse);
}

Fixed version (ground truth):
@Override public void execute(){
  VpnUser vpnUser=_entityMgr.findById(VpnUser.class,getEntityId());
  Account account=_entityMgr.findById(Account.class,vpnUser.getAccountId());
  try {
    if (!_ravService.applyVpnUsers(vpnUser.getAccountId(),userName)) {
      throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  Exception ex) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  VpnUsersResponse vpnResponse=new VpnUsersResponse();
  vpnResponse.setId(vpnUser.getUuid());
  vpnResponse.setUserName(vpnUser.getUsername());
  vpnResponse.setAccountName(account.getAccountName());
  Domain domain=_entityMgr.findById(Domain.class,account.getDomainId());
  if (domain != null) {
    vpnResponse.setDomainId(domain.getUuid());
    vpnResponse.setDomainName(domain.getName());
  }
  vpnResponse.setResponseName(getCommandName());
  vpnResponse.setObjectName("String_Node_Str");
  setResponseObject(vpnResponse);
}
Program: 105133
Project: 105133
Buggy source:
@Override public void execute(){
  Account owner=_accountService.getAccount(getEntityOwnerId());
  boolean result=_ravService.removeVpnUser(owner.getId(),userName,CallContext.current().getCallingAccount());
  if (!result) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  if (!_ravService.applyVpnUsers(owner.getId(),userName)) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  SuccessResponse response=new SuccessResponse(getCommandName());
  setResponseObject(response);
}

Fixed version (ground truth):
@Override public void execute(){
  Account owner=_accountService.getAccount(getEntityOwnerId());
  boolean result=_ravService.removeVpnUser(owner.getId(),userName,CallContext.current().getCallingAccount());
  if (!result) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  try {
    if (!_ravService.applyVpnUsers(owner.getId(),userName)) {
      throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  Exception ex) {
    throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"String_Node_Str");
  }
  SuccessResponse response=new SuccessResponse(getCommandName());
  setResponseObject(response);
}
Program: 105135
Project: 105135
Buggy source:
@Override public boolean isRedundant(){
  return this.isRedundant;
}

Fixed version (ground truth):
@Override public boolean isRedundant(){
  return this.redundant;
}
Program: 105136
Project: 105136
Buggy source:
public void setIsReduntant(boolean reduntant){
  this.isRedundant=reduntant;
}

Fixed version (ground truth):
public void setIsReduntant(boolean reduntant){
  this.redundant=reduntant;
}
Program: 105139
Project: 105139
Buggy source:
@Override public void prepareForMigration(VirtualMachineProfile vm,DeployDestination dest){
  List<VolumeVO> vols=_volsDao.findUsableVolumesForInstance(vm.getId());
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vols.size() + "String_Node_Str"+ vm);
  }
  for (  VolumeVO vol : vols) {
    DataTO volTO=volFactory.getVolume(vol.getId()).getTO();
    DiskTO disk=new DiskTO(volTO,vol.getDeviceId(),vol.getPath(),vol.getVolumeType());
    VolumeInfo volumeInfo=volFactory.getVolume(vol.getId());
    DataStore dataStore=dataStoreMgr.getDataStore(vol.getPoolId(),DataStoreRole.Primary);
    disk.setDetails(getDetails(volumeInfo,dataStore));
    vm.addDisk(disk);
  }
  if (vm.getType() == VirtualMachine.Type.User) {
    _tmpltMgr.prepareIsoForVmProfile(vm);
  }
}

Fixed version (ground truth):
@Override public void prepareForMigration(VirtualMachineProfile vm,DeployDestination dest){
  List<VolumeVO> vols=_volsDao.findUsableVolumesForInstance(vm.getId());
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vols.size() + "String_Node_Str"+ vm);
  }
  for (  VolumeVO vol : vols) {
    VolumeInfo volumeInfo=volFactory.getVolume(vol.getId());
    DataTO volTO=volumeInfo.getTO();
    DiskTO disk=storageMgr.getDiskWithThrottling(volTO,vol.getVolumeType(),vol.getDeviceId(),vol.getPath(),vm.getServiceOfferingId(),vol.getDiskOfferingId());
    DataStore dataStore=dataStoreMgr.getDataStore(vol.getPoolId(),DataStoreRole.Primary);
    disk.setDetails(getDetails(volumeInfo,dataStore));
    vm.addDisk(disk);
  }
  if (vm.getType() == VirtualMachine.Type.User) {
    _tmpltMgr.prepareIsoForVmProfile(vm);
  }
}
Program: 105141
Project: 105141
Buggy source:
@Override public VolumeInfo moveVolume(VolumeInfo volume,long destPoolDcId,Long destPoolPodId,Long destPoolClusterId,HypervisorType dataDiskHyperType) throws ConcurrentOperationException, StorageUnavailableException {
  DiskOffering diskOffering=_entityMgr.findById(DiskOffering.class,volume.getDiskOfferingId());
  ;
  DiskProfile dskCh=new DiskProfile(volume.getId(),volume.getVolumeType(),volume.getName(),diskOffering.getId(),diskOffering.getDiskSize(),diskOffering.getTagsArray(),diskOffering.getUseLocalStorage(),diskOffering.isRecreatable(),null);
  dskCh.setHyperType(dataDiskHyperType);
  DataCenter destPoolDataCenter=_entityMgr.findById(DataCenter.class,destPoolDcId);
  Pod destPoolPod=_entityMgr.findById(Pod.class,destPoolPodId);
  StoragePool destPool=findStoragePool(dskCh,destPoolDataCenter,destPoolPod,destPoolClusterId,null,null,new HashSet<StoragePool>());
  if (destPool == null) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  Volume newVol=migrateVolume(volume,destPool);
  return volFactory.getVolume(newVol.getId());
}

Fixed version (ground truth):
@Override public VolumeInfo moveVolume(VolumeInfo volume,long destPoolDcId,Long destPoolPodId,Long destPoolClusterId,HypervisorType dataDiskHyperType) throws ConcurrentOperationException, StorageUnavailableException {
  DiskOffering diskOffering=_entityMgr.findById(DiskOffering.class,volume.getDiskOfferingId());
  DiskProfile dskCh=new DiskProfile(volume.getId(),volume.getVolumeType(),volume.getName(),diskOffering.getId(),diskOffering.getDiskSize(),diskOffering.getTagsArray(),diskOffering.getUseLocalStorage(),diskOffering.isRecreatable(),null);
  dskCh.setHyperType(dataDiskHyperType);
  storageMgr.setDiskProfileThrottling(dskCh,null,diskOffering);
  DataCenter destPoolDataCenter=_entityMgr.findById(DataCenter.class,destPoolDcId);
  Pod destPoolPod=_entityMgr.findById(Pod.class,destPoolPodId);
  StoragePool destPool=findStoragePool(dskCh,destPoolDataCenter,destPoolPod,destPoolClusterId,null,null,new HashSet<StoragePool>());
  if (destPool == null) {
    throw new CloudRuntimeException("String_Node_Str");
  }
  Volume newVol=migrateVolume(volume,destPool);
  return volFactory.getVolume(newVol.getId());
}
Program: 105142
Project: 105142
Buggy source:
@DB public VolumeInfo copyVolumeFromSecToPrimary(VolumeInfo volume,VirtualMachine vm,VirtualMachineTemplate template,DataCenter dc,Pod pod,Long clusterId,ServiceOffering offering,DiskOffering diskOffering,List<StoragePool> avoids,long size,HypervisorType hyperType) throws NoTransitionException {
  final HashSet<StoragePool> avoidPools=new HashSet<StoragePool>(avoids);
  DiskProfile dskCh=createDiskCharacteristics(volume,template,dc,diskOffering);
  dskCh.setHyperType(vm.getHypervisorType());
  StoragePool destPool=findStoragePool(dskCh,dc,pod,clusterId,null,vm,avoidPools);
  DataStore destStore=dataStoreMgr.getDataStore(destPool.getId(),DataStoreRole.Primary);
  AsyncCallFuture<VolumeApiResult> future=volService.copyVolume(volume,destStore);
  try {
    VolumeApiResult result=future.get();
    if (result.isFailed()) {
      s_logger.debug("String_Node_Str" + result.getResult());
      throw new CloudRuntimeException("String_Node_Str" + result.getResult());
    }
    return result.getVolume();
  }
 catch (  InterruptedException e) {
    s_logger.debug("String_Node_Str" + volume.getId(),e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
catch (  ExecutionException e) {
    s_logger.debug("String_Node_Str" + volume.getId(),e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@DB public VolumeInfo copyVolumeFromSecToPrimary(VolumeInfo volume,VirtualMachine vm,VirtualMachineTemplate template,DataCenter dc,Pod pod,Long clusterId,ServiceOffering offering,DiskOffering diskOffering,List<StoragePool> avoids,long size,HypervisorType hyperType) throws NoTransitionException {
  final HashSet<StoragePool> avoidPools=new HashSet<StoragePool>(avoids);
  DiskProfile dskCh=createDiskCharacteristics(volume,template,dc,diskOffering);
  dskCh.setHyperType(vm.getHypervisorType());
  storageMgr.setDiskProfileThrottling(dskCh,null,diskOffering);
  StoragePool destPool=findStoragePool(dskCh,dc,pod,clusterId,null,vm,avoidPools);
  DataStore destStore=dataStoreMgr.getDataStore(destPool.getId(),DataStoreRole.Primary);
  AsyncCallFuture<VolumeApiResult> future=volService.copyVolume(volume,destStore);
  try {
    VolumeApiResult result=future.get();
    if (result.isFailed()) {
      s_logger.debug("String_Node_Str" + result.getResult());
      throw new CloudRuntimeException("String_Node_Str" + result.getResult());
    }
    return result.getVolume();
  }
 catch (  InterruptedException e) {
    s_logger.debug("String_Node_Str" + volume.getId(),e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
catch (  ExecutionException e) {
    s_logger.debug("String_Node_Str" + volume.getId(),e);
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}
Program: 105144
Project: 105144
Buggy source:
@Override public Answer dettachVolume(final DettachCommand cmd){
  final DiskTO disk=cmd.getDisk();
  final VolumeObjectTO vol=(VolumeObjectTO)disk.getData();
  final PrimaryDataStoreTO primaryStore=(PrimaryDataStoreTO)vol.getDataStore();
  final String vmName=cmd.getVmName();
  final String serial=resource.diskUuidToSerial(vol.getUuid());
  try {
    final Connect conn=LibvirtConnection.getConnectionByVmName(vmName);
    final KVMPhysicalDisk phyDisk=storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(),primaryStore.getUuid(),vol.getPath());
    attachOrDetachDisk(conn,false,vmName,phyDisk,disk.getDiskSeq().intValue(),serial);
    storagePoolMgr.disconnectPhysicalDisk(primaryStore.getPoolType(),primaryStore.getUuid(),vol.getPath());
    return new DettachAnswer(disk);
  }
 catch (  final LibvirtException e) {
    s_logger.debug("String_Node_Str" + vol.getPath() + "String_Node_Str",e);
    return new DettachAnswer(e.toString());
  }
catch (  final InternalErrorException e) {
    s_logger.debug("String_Node_Str" + vol.getPath() + "String_Node_Str",e);
    return new DettachAnswer(e.toString());
  }
}

Fixed version (ground truth):
@Override public Answer dettachVolume(final DettachCommand cmd){
  final DiskTO disk=cmd.getDisk();
  final VolumeObjectTO vol=(VolumeObjectTO)disk.getData();
  final PrimaryDataStoreTO primaryStore=(PrimaryDataStoreTO)vol.getDataStore();
  final String vmName=cmd.getVmName();
  final String serial=resource.diskUuidToSerial(vol.getUuid());
  try {
    final Connect conn=LibvirtConnection.getConnectionByVmName(vmName);
    final KVMPhysicalDisk phyDisk=storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(),primaryStore.getUuid(),vol.getPath());
    attachOrDetachDisk(conn,false,vmName,phyDisk,disk.getDiskSeq().intValue(),serial,vol.getBytesReadRate(),vol.getBytesWriteRate(),vol.getIopsReadRate(),vol.getIopsWriteRate());
    storagePoolMgr.disconnectPhysicalDisk(primaryStore.getPoolType(),primaryStore.getUuid(),vol.getPath());
    return new DettachAnswer(disk);
  }
 catch (  final LibvirtException e) {
    s_logger.debug("String_Node_Str" + vol.getPath() + "String_Node_Str",e);
    return new DettachAnswer(e.toString());
  }
catch (  final InternalErrorException e) {
    s_logger.debug("String_Node_Str" + vol.getPath() + "String_Node_Str",e);
    return new DettachAnswer(e.toString());
  }
}