nus-yam/ex-repair huggingface dataset:
Program: 106205
Project: 106205
Buggy source:
@Override public Answer copyVolumeFromPrimaryToSecondary(CopyCommand cmd){
  Connection conn=hypervisorResource.getConnection();
  VolumeObjectTO srcVolume=(VolumeObjectTO)cmd.getSrcTO();
  VolumeObjectTO destVolume=(VolumeObjectTO)cmd.getDestTO();
  int wait=cmd.getWait();
  DataStoreTO destStore=destVolume.getDataStore();
  if (destStore instanceof NfsTO) {
    SR secondaryStorage=null;
    try {
      NfsTO nfsStore=(NfsTO)destStore;
      URI uri=new URI(nfsStore.getUrl());
      if (!hypervisorResource.createSecondaryStorageFolder(conn,uri.getHost() + "String_Node_Str" + uri.getPath(),destVolume.getPath())) {
        throw new InternalErrorException("String_Node_Str");
      }
      secondaryStorage=hypervisorResource.createNfsSRbyURI(conn,new URI(nfsStore.getUrl() + destVolume.getPath()),false);
      VDI srcVdi=getVDIbyUuid(conn,srcVolume.getPath());
      VDI destVdi=hypervisorResource.cloudVDIcopy(conn,srcVdi,secondaryStorage,wait);
      String destVolumeUUID=destVdi.getUuid(conn);
      VolumeObjectTO newVol=new VolumeObjectTO();
      newVol.setPath(destVolume.getPath() + File.separator + destVolumeUUID+ "String_Node_Str");
      newVol.setSize(srcVolume.getSize());
      return new CopyCmdAnswer(newVol);
    }
 catch (    Exception e) {
      s_logger.debug("String_Node_Str" + e.toString());
      return new CopyCmdAnswer("String_Node_Str" + e.toString());
    }
 finally {
      hypervisorResource.removeSR(conn,secondaryStorage);
    }
  }
  return new CopyCmdAnswer("String_Node_Str");
}

Fixed version (ground truth):
@Override public Answer copyVolumeFromPrimaryToSecondary(CopyCommand cmd){
  Connection conn=hypervisorResource.getConnection();
  VolumeObjectTO srcVolume=(VolumeObjectTO)cmd.getSrcTO();
  VolumeObjectTO destVolume=(VolumeObjectTO)cmd.getDestTO();
  int wait=cmd.getWait();
  DataStoreTO destStore=destVolume.getDataStore();
  if (destStore instanceof NfsTO) {
    SR secondaryStorage=null;
    try {
      NfsTO nfsStore=(NfsTO)destStore;
      URI uri=new URI(nfsStore.getUrl());
      if (!hypervisorResource.createSecondaryStorageFolder(conn,uri.getHost() + "String_Node_Str" + uri.getPath(),destVolume.getPath())) {
        throw new InternalErrorException("String_Node_Str");
      }
      secondaryStorage=hypervisorResource.createNfsSRbyURI(conn,new URI(nfsStore.getUrl() + File.separator + destVolume.getPath()),false);
      VDI srcVdi=getVDIbyUuid(conn,srcVolume.getPath());
      VDI destVdi=hypervisorResource.cloudVDIcopy(conn,srcVdi,secondaryStorage,wait);
      String destVolumeUUID=destVdi.getUuid(conn);
      VolumeObjectTO newVol=new VolumeObjectTO();
      newVol.setPath(destVolume.getPath() + File.separator + destVolumeUUID+ "String_Node_Str");
      newVol.setSize(srcVolume.getSize());
      return new CopyCmdAnswer(newVol);
    }
 catch (    Exception e) {
      s_logger.debug("String_Node_Str" + e.toString());
      return new CopyCmdAnswer("String_Node_Str" + e.toString());
    }
 finally {
      hypervisorResource.removeSR(conn,secondaryStorage);
    }
  }
  return new CopyCmdAnswer("String_Node_Str");
}
Program: 106208
Project: 106208
Buggy source:
private void deleteNetworkBridges(Network network){
  long accountID=network.getAccountId();
  long networkID=network.getId();
  Bridge netBridge=getNetworkBridge(networkID,accountID);
  if (netBridge != null) {
    cleanBridge(netBridge);
    for (    Object dhcpSubnet : netBridge.getDhcpSubnets()) {
      DhcpSubnet sub=(DhcpSubnet)dhcpSubnet;
      sub.delete();
    }
    netBridge.delete();
  }
}

Fixed version (ground truth):
private void deleteNetworkBridges(Network network){
  String accountUuid=getAccountUuid(network);
  long networkID=network.getId();
  Bridge netBridge=getNetworkBridge(networkID,accountUuid);
  if (netBridge != null) {
    cleanBridge(netBridge);
    for (    Object dhcpSubnet : netBridge.getDhcpSubnets()) {
      DhcpSubnet sub=(DhcpSubnet)dhcpSubnet;
      sub.delete();
    }
    netBridge.delete();
  }
}
Program: 106210
Project: 106210
Buggy source:
public boolean associatePublicIP(Network network,final List<? extends PublicIpAddress> ipAddress) throws ResourceUnavailableException {
  s_logger.debug("String_Node_Str" + network.toString());
  boolean resources=false;
  Router tenantRouter=null;
  Router providerRouter=null;
  RouterPort[] ports=null;
  RouterPort tenantUplink=null;
  RouterPort providerDownlink=null;
  RuleChain preNat=null;
  RuleChain post=null;
  String accountIdStr=null;
  String routerName=null;
  for (  PublicIpAddress ip : ipAddress) {
    if (ip.isSourceNat()) {
      if (resources == false) {
        tenantRouter=getOrCreateGuestNetworkRouter(network);
        providerRouter=api.getRouter(_providerRouterId);
        ports=getOrCreateProviderRouterPorts(tenantRouter,providerRouter);
        tenantUplink=ports[0];
        providerDownlink=ports[1];
        accountIdStr=String.valueOf(network.getAccountId());
        boolean isVpc=getIsVpc(network);
        long id=getRouterId(network,isVpc);
        routerName=getRouterName(isVpc,id);
        preNat=getChain(accountIdStr,routerName,RuleChainCode.TR_PRENAT);
        post=api.getChain(tenantRouter.getOutboundFilterId());
        resources=true;
      }
      applySourceNat(tenantRouter,providerRouter,tenantUplink,providerDownlink,preNat,post,ip);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean associatePublicIP(Network network,final List<? extends PublicIpAddress> ipAddress) throws ResourceUnavailableException {
  s_logger.debug("String_Node_Str" + network.toString());
  boolean resources=false;
  Router tenantRouter=null;
  Router providerRouter=null;
  RouterPort[] ports=null;
  RouterPort tenantUplink=null;
  RouterPort providerDownlink=null;
  RuleChain preNat=null;
  RuleChain post=null;
  String accountIdStr=null;
  String routerName=null;
  for (  PublicIpAddress ip : ipAddress) {
    if (ip.isSourceNat()) {
      if (resources == false) {
        tenantRouter=getOrCreateGuestNetworkRouter(network);
        providerRouter=api.getRouter(_providerRouterId);
        ports=getOrCreateProviderRouterPorts(tenantRouter,providerRouter);
        tenantUplink=ports[0];
        providerDownlink=ports[1];
        accountIdStr=getAccountUuid(network);
        boolean isVpc=getIsVpc(network);
        long id=getRouterId(network,isVpc);
        routerName=getRouterName(isVpc,id);
        preNat=getChain(accountIdStr,routerName,RuleChainCode.TR_PRENAT);
        post=api.getChain(tenantRouter.getOutboundFilterId());
        resources=true;
      }
      applySourceNat(tenantRouter,providerRouter,tenantUplink,providerDownlink,preNat,post,ip);
    }
  }
  return true;
}
Program: 106212
Project: 106212
Buggy source:
private Router getGuestNetworkRouter(long id,long accountID,boolean isVpc){
  MultivaluedMap qNetRouter=new MultivaluedMapImpl();
  String accountIdStr=String.valueOf(accountID);
  String routerName=getRouterName(isVpc,id);
  qNetRouter.add("String_Node_Str",accountIdStr);
  for (  Router router : api.getRouters(qNetRouter)) {
    if (router.getName().equals(routerName)) {
      return router;
    }
  }
  return null;
}

Fixed version (ground truth):
private Router getGuestNetworkRouter(long id,String accountUuid,boolean isVpc){
  MultivaluedMap qNetRouter=new MultivaluedMapImpl();
  String routerName=getRouterName(isVpc,id);
  qNetRouter.add("String_Node_Str",accountUuid);
  for (  Router router : api.getRouters(qNetRouter)) {
    if (router.getName().equals(routerName)) {
      return router;
    }
  }
  return null;
}
Program: 106215
Project: 106215
Buggy source:
private Router getOrCreateGuestNetworkRouter(long id,long accountID,boolean isVpc){
  Router tenantRouter=getGuestNetworkRouter(id,accountID,isVpc);
  if (tenantRouter == null) {
    tenantRouter=createRouter(id,accountID,isVpc);
  }
  return tenantRouter;
}

Fixed version (ground truth):
private Router getOrCreateGuestNetworkRouter(long id,String accountUuid,boolean isVpc){
  Router tenantRouter=getGuestNetworkRouter(id,accountUuid,isVpc);
  if (tenantRouter == null) {
    tenantRouter=createRouter(id,accountUuid,isVpc);
  }
  return tenantRouter;
}
Program: 106217
Project: 106217
Buggy source:
protected RuleChain getChain(String networkId,String accountID,String routerName,RuleChainCode chainCode){
  String chainName=getChainName(networkId,routerName,chainCode);
  MultivaluedMap findChain=new MultivaluedMapImpl();
  findChain.add("String_Node_Str",accountID);
  ResourceCollection<RuleChain> ruleChains=api.getChains(findChain);
  for (  RuleChain chain : ruleChains) {
    if (chain.getName().equals(chainName)) {
      return chain;
    }
  }
  return null;
}

Fixed version (ground truth):
protected RuleChain getChain(String networkId,String accountUuid,String routerName,RuleChainCode chainCode){
  String chainName=getChainName(networkId,routerName,chainCode);
  MultivaluedMap findChain=new MultivaluedMapImpl();
  findChain.add("String_Node_Str",accountUuid);
  ResourceCollection<RuleChain> ruleChains=api.getChains(findChain);
  for (  RuleChain chain : ruleChains) {
    if (chain.getName().equals(chainName)) {
      return chain;
    }
  }
  return null;
}
Program: 106218
Project: 106218
Buggy source:
protected void resetEgressACLFilter(Network network){
  boolean isVpc=getIsVpc(network);
  long id=getRouterId(network,isVpc);
  String routerName=getRouterName(isVpc,id);
  RuleChain egressChain=getChain(String.valueOf(network.getId()),String.valueOf(network.getAccountId()),routerName,RuleChainCode.ACL_EGRESS);
  for (  Rule rule : egressChain.getRules()) {
    rule.delete();
  }
  egressChain.addRule().type(DtoRule.Accept).matchForwardFlow(true).position(1).create();
}

Fixed version (ground truth):
protected void resetEgressACLFilter(Network network){
  boolean isVpc=getIsVpc(network);
  long id=getRouterId(network,isVpc);
  String routerName=getRouterName(isVpc,id);
  RuleChain egressChain=getChain(String.valueOf(network.getId()),getAccountUuid(network),routerName,RuleChainCode.ACL_EGRESS);
  for (  Rule rule : egressChain.getRules()) {
    rule.delete();
  }
  egressChain.addRule().type(DtoRule.Accept).matchForwardFlow(true).position(1).create();
}
Program: 106219
Project: 106219
Buggy source:
public boolean midoInNetwork(Network network){
  for (  String pname : _ntwkSrvcDao.getDistinctProviders(network.getId())) {
    if (pname.equals(getProvider().getName())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean midoInNetwork(Network network){
  if ((network.getTrafficType() == Networks.TrafficType.Public) && (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Mido)) {
    return true;
  }
  if ((network.getTrafficType() == Networks.TrafficType.Guest) && (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Mido)) {
    return true;
  }
  return false;
}
Program: 106220
Project: 106220
Buggy source:
protected RuleChain getOrInitEgressACLFilter(Network network){
  boolean isVpc=getIsVpc(network);
  long id=getRouterId(network,isVpc);
  String routerName=getRouterName(isVpc,id);
  RuleChain egressChain=getChain(String.valueOf(network.getId()),String.valueOf(network.getAccountId()),routerName,RuleChainCode.ACL_EGRESS);
  int totalRules=0;
  for (  Rule rule : egressChain.getRules()) {
    if (rule.getNwProto() != 0) {
      totalRules++;
    }
  }
  if (totalRules > 0) {
    return egressChain;
  }
 else {
    for (    Rule rule : egressChain.getRules()) {
      rule.delete();
    }
  }
  int pos=1;
  egressChain.addRule().type(DtoRule.Accept).dlType((short)0x0806).position(pos++).create();
  egressChain.addRule().type(DtoRule.Drop).position(pos).create();
  return egressChain;
}

Fixed version (ground truth):
protected RuleChain getOrInitEgressACLFilter(Network network){
  boolean isVpc=getIsVpc(network);
  long id=getRouterId(network,isVpc);
  String routerName=getRouterName(isVpc,id);
  RuleChain egressChain=getChain(String.valueOf(network.getId()),getAccountUuid(network),routerName,RuleChainCode.ACL_EGRESS);
  int totalRules=0;
  for (  Rule rule : egressChain.getRules()) {
    if (rule.getNwProto() != 0) {
      totalRules++;
    }
  }
  if (totalRules > 0) {
    return egressChain;
  }
 else {
    for (    Rule rule : egressChain.getRules()) {
      rule.delete();
    }
  }
  int pos=1;
  egressChain.addRule().type(DtoRule.Accept).dlType((short)0x0806).position(pos++).create();
  egressChain.addRule().type(DtoRule.Accept).nwProto(SimpleFirewallRule.stringToProtocolNumber("String_Node_Str")).nwDstAddress(network.getGateway()).nwDstLength(32).position(pos++).create();
  egressChain.addRule().type(DtoRule.Drop).position(pos).create();
  return egressChain;
}
Program: 106221
Project: 106221
Buggy source:
private Bridge getNetworkBridge(long networkID,long accountID){
  MultivaluedMap qNetBridge=new MultivaluedMapImpl();
  String accountIdStr=String.valueOf(accountID);
  String networkUUIDStr=String.valueOf(networkID);
  qNetBridge.add("String_Node_Str",accountIdStr);
  for (  Bridge b : this.api.getBridges(qNetBridge)) {
    if (b.getName().equals(networkUUIDStr)) {
      return b;
    }
  }
  return null;
}

Fixed version (ground truth):
private Bridge getNetworkBridge(long networkID,String accountUuid){
  MultivaluedMap qNetBridge=new MultivaluedMapImpl();
  String networkUUIDStr=String.valueOf(networkID);
  qNetBridge.add("String_Node_Str",accountUuid);
  for (  Bridge b : this.api.getBridges(qNetBridge)) {
    if (b.getName().equals(networkUUIDStr)) {
      return b;
    }
  }
  return null;
}
Program: 106222
Project: 106222
Buggy source:
protected Router createRouter(long id,long accountID,boolean isVpc){
  String accountIdStr=String.valueOf(accountID);
  String routerName=getRouterName(isVpc,id);
  RuleChain pre=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PRE)).tenantId(accountIdStr).create();
  RuleChain post=api.addChain().name(getChainName(routerName,RuleChainCode.TR_POST)).tenantId(accountIdStr).create();
  RuleChain preFilter=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PREFILTER)).tenantId(accountIdStr).create();
  RuleChain preNat=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PRENAT)).tenantId(accountIdStr).create();
  pre.addRule().type(DtoRule.Jump).jumpChainId(preFilter.getId()).position(1).create();
  pre.addRule().type(DtoRule.Jump).jumpChainId(preNat.getId()).position(2).create();
  return api.addRouter().tenantId(accountIdStr).name(routerName).inboundFilterId(pre.getId()).outboundFilterId(post.getId()).create();
}

Fixed version (ground truth):
protected Router createRouter(long id,String accountUuid,boolean isVpc){
  String routerName=getRouterName(isVpc,id);
  RuleChain pre=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PRE)).tenantId(accountUuid).create();
  RuleChain post=api.addChain().name(getChainName(routerName,RuleChainCode.TR_POST)).tenantId(accountUuid).create();
  RuleChain preFilter=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PREFILTER)).tenantId(accountUuid).create();
  RuleChain preNat=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PRENAT)).tenantId(accountUuid).create();
  pre.addRule().type(DtoRule.Jump).jumpChainId(preFilter.getId()).position(1).create();
  pre.addRule().type(DtoRule.Jump).jumpChainId(preNat.getId()).position(2).create();
  return api.addRouter().tenantId(accountUuid).name(routerName).inboundFilterId(pre.getId()).outboundFilterId(post.getId()).create();
}
Program: 106223
Project: 106223
Buggy source:
private Bridge getOrCreateNetworkBridge(long networkID,long accountID){
  Bridge netBridge=getNetworkBridge(networkID,accountID);
  if (netBridge == null) {
    String accountIdStr=String.valueOf(accountID);
    String networkUUIDStr=String.valueOf(networkID);
    netBridge=api.addBridge().tenantId(accountIdStr).name(networkUUIDStr).create();
  }
  return netBridge;
}

Fixed version (ground truth):
private Bridge getOrCreateNetworkBridge(long networkID,String accountUuid){
  Bridge netBridge=getNetworkBridge(networkID,accountUuid);
  if (netBridge == null) {
    String networkUUIDStr=String.valueOf(networkID);
    netBridge=api.addBridge().tenantId(accountUuid).name(networkUUIDStr).create();
  }
  return netBridge;
}
Program: 106224
Project: 106224
Buggy source:
public void setSize(long size){
  this.size=size;
}

Fixed version (ground truth):
public void setSize(Long size){
  this.size=size;
}
Program: 106225
Project: 106225
Buggy source:
@Override public void addSystemVMTemplatesToSecondary(DataStore store){
  long storeId=store.getId();
  List<VMTemplateVO> rtngTmplts=_templateDao.listAllSystemVMTemplates();
  for (  VMTemplateVO tmplt : rtngTmplts) {
    TemplateDataStoreVO tmpltStore=_vmTemplateStoreDao.findByStoreTemplate(storeId,tmplt.getId());
    if (tmpltStore == null) {
      tmpltStore=new TemplateDataStoreVO(storeId,tmplt.getId(),new Date(),100,Status.DOWNLOADED,null,null,null,TemplateConstants.DEFAULT_SYSTEM_VM_TEMPLATE_PATH + tmplt.getId() + File.separator,tmplt.getUrl());
      tmpltStore.setSize(0);
      tmpltStore.setPhysicalSize(0);
      tmpltStore.setDataStoreRole(store.getRole());
      _vmTemplateStoreDao.persist(tmpltStore);
    }
  }
}

Fixed version (ground truth):
@Override public void addSystemVMTemplatesToSecondary(DataStore store){
  long storeId=store.getId();
  List<VMTemplateVO> rtngTmplts=_templateDao.listAllSystemVMTemplates();
  for (  VMTemplateVO tmplt : rtngTmplts) {
    TemplateDataStoreVO tmpltStore=_vmTemplateStoreDao.findByStoreTemplate(storeId,tmplt.getId());
    if (tmpltStore == null) {
      tmpltStore=new TemplateDataStoreVO(storeId,tmplt.getId(),new Date(),100,Status.DOWNLOADED,null,null,null,TemplateConstants.DEFAULT_SYSTEM_VM_TEMPLATE_PATH + tmplt.getId() + File.separator,tmplt.getUrl());
      tmpltStore.setSize(0L);
      tmpltStore.setPhysicalSize(0);
      tmpltStore.setDataStoreRole(store.getRole());
      _vmTemplateStoreDao.persist(tmpltStore);
    }
  }
}
Program: 106229
Project: 106229
Buggy source:
private void deleteNetworkBridges(Network network){
  long accountID=network.getAccountId();
  long networkID=network.getId();
  Bridge netBridge=getNetworkBridge(networkID,accountID);
  if (netBridge != null) {
    cleanBridge(netBridge);
    for (    Object dhcpSubnet : netBridge.getDhcpSubnets()) {
      DhcpSubnet sub=(DhcpSubnet)dhcpSubnet;
      sub.delete();
    }
    netBridge.delete();
  }
}

Fixed version (ground truth):
private void deleteNetworkBridges(Network network){
  String accountUuid=getAccountUuid(network);
  long networkID=network.getId();
  Bridge netBridge=getNetworkBridge(networkID,accountUuid);
  if (netBridge != null) {
    cleanBridge(netBridge);
    for (    Object dhcpSubnet : netBridge.getDhcpSubnets()) {
      DhcpSubnet sub=(DhcpSubnet)dhcpSubnet;
      sub.delete();
    }
    netBridge.delete();
  }
}
Program: 106231
Project: 106231
Buggy source:
public boolean associatePublicIP(Network network,final List<? extends PublicIpAddress> ipAddress) throws ResourceUnavailableException {
  s_logger.debug("String_Node_Str" + network.toString());
  boolean resources=false;
  Router tenantRouter=null;
  Router providerRouter=null;
  RouterPort[] ports=null;
  RouterPort tenantUplink=null;
  RouterPort providerDownlink=null;
  RuleChain preNat=null;
  RuleChain post=null;
  String accountIdStr=null;
  String routerName=null;
  for (  PublicIpAddress ip : ipAddress) {
    if (ip.isSourceNat()) {
      if (resources == false) {
        tenantRouter=getOrCreateGuestNetworkRouter(network);
        providerRouter=api.getRouter(_providerRouterId);
        ports=getOrCreateProviderRouterPorts(tenantRouter,providerRouter);
        tenantUplink=ports[0];
        providerDownlink=ports[1];
        accountIdStr=String.valueOf(network.getAccountId());
        boolean isVpc=getIsVpc(network);
        long id=getRouterId(network,isVpc);
        routerName=getRouterName(isVpc,id);
        preNat=getChain(accountIdStr,routerName,RuleChainCode.TR_PRENAT);
        post=api.getChain(tenantRouter.getOutboundFilterId());
        resources=true;
      }
      applySourceNat(tenantRouter,providerRouter,tenantUplink,providerDownlink,preNat,post,ip);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean associatePublicIP(Network network,final List<? extends PublicIpAddress> ipAddress) throws ResourceUnavailableException {
  s_logger.debug("String_Node_Str" + network.toString());
  boolean resources=false;
  Router tenantRouter=null;
  Router providerRouter=null;
  RouterPort[] ports=null;
  RouterPort tenantUplink=null;
  RouterPort providerDownlink=null;
  RuleChain preNat=null;
  RuleChain post=null;
  String accountIdStr=null;
  String routerName=null;
  for (  PublicIpAddress ip : ipAddress) {
    if (ip.isSourceNat()) {
      if (resources == false) {
        tenantRouter=getOrCreateGuestNetworkRouter(network);
        providerRouter=api.getRouter(_providerRouterId);
        ports=getOrCreateProviderRouterPorts(tenantRouter,providerRouter);
        tenantUplink=ports[0];
        providerDownlink=ports[1];
        accountIdStr=getAccountUuid(network);
        boolean isVpc=getIsVpc(network);
        long id=getRouterId(network,isVpc);
        routerName=getRouterName(isVpc,id);
        preNat=getChain(accountIdStr,routerName,RuleChainCode.TR_PRENAT);
        post=api.getChain(tenantRouter.getOutboundFilterId());
        resources=true;
      }
      applySourceNat(tenantRouter,providerRouter,tenantUplink,providerDownlink,preNat,post,ip);
    }
  }
  return true;
}
Program: 106233
Project: 106233
Buggy source:
private Router getGuestNetworkRouter(long id,long accountID,boolean isVpc){
  MultivaluedMap qNetRouter=new MultivaluedMapImpl();
  String accountIdStr=String.valueOf(accountID);
  String routerName=getRouterName(isVpc,id);
  qNetRouter.add("String_Node_Str",accountIdStr);
  for (  Router router : api.getRouters(qNetRouter)) {
    if (router.getName().equals(routerName)) {
      return router;
    }
  }
  return null;
}

Fixed version (ground truth):
private Router getGuestNetworkRouter(long id,String accountUuid,boolean isVpc){
  MultivaluedMap qNetRouter=new MultivaluedMapImpl();
  String routerName=getRouterName(isVpc,id);
  qNetRouter.add("String_Node_Str",accountUuid);
  for (  Router router : api.getRouters(qNetRouter)) {
    if (router.getName().equals(routerName)) {
      return router;
    }
  }
  return null;
}
Program: 106236
Project: 106236
Buggy source:
private Router getOrCreateGuestNetworkRouter(long id,long accountID,boolean isVpc){
  Router tenantRouter=getGuestNetworkRouter(id,accountID,isVpc);
  if (tenantRouter == null) {
    tenantRouter=createRouter(id,accountID,isVpc);
  }
  return tenantRouter;
}

Fixed version (ground truth):
private Router getOrCreateGuestNetworkRouter(long id,String accountUuid,boolean isVpc){
  Router tenantRouter=getGuestNetworkRouter(id,accountUuid,isVpc);
  if (tenantRouter == null) {
    tenantRouter=createRouter(id,accountUuid,isVpc);
  }
  return tenantRouter;
}
Program: 106238
Project: 106238
Buggy source:
protected RuleChain getChain(String networkId,String accountID,String routerName,RuleChainCode chainCode){
  String chainName=getChainName(networkId,routerName,chainCode);
  MultivaluedMap findChain=new MultivaluedMapImpl();
  findChain.add("String_Node_Str",accountID);
  ResourceCollection<RuleChain> ruleChains=api.getChains(findChain);
  for (  RuleChain chain : ruleChains) {
    if (chain.getName().equals(chainName)) {
      return chain;
    }
  }
  return null;
}

Fixed version (ground truth):
protected RuleChain getChain(String networkId,String accountUuid,String routerName,RuleChainCode chainCode){
  String chainName=getChainName(networkId,routerName,chainCode);
  MultivaluedMap findChain=new MultivaluedMapImpl();
  findChain.add("String_Node_Str",accountUuid);
  ResourceCollection<RuleChain> ruleChains=api.getChains(findChain);
  for (  RuleChain chain : ruleChains) {
    if (chain.getName().equals(chainName)) {
      return chain;
    }
  }
  return null;
}
Program: 106239
Project: 106239
Buggy source:
protected void resetEgressACLFilter(Network network){
  boolean isVpc=getIsVpc(network);
  long id=getRouterId(network,isVpc);
  String routerName=getRouterName(isVpc,id);
  RuleChain egressChain=getChain(String.valueOf(network.getId()),String.valueOf(network.getAccountId()),routerName,RuleChainCode.ACL_EGRESS);
  for (  Rule rule : egressChain.getRules()) {
    rule.delete();
  }
  egressChain.addRule().type(DtoRule.Accept).matchForwardFlow(true).position(1).create();
}

Fixed version (ground truth):
protected void resetEgressACLFilter(Network network){
  boolean isVpc=getIsVpc(network);
  long id=getRouterId(network,isVpc);
  String routerName=getRouterName(isVpc,id);
  RuleChain egressChain=getChain(String.valueOf(network.getId()),getAccountUuid(network),routerName,RuleChainCode.ACL_EGRESS);
  for (  Rule rule : egressChain.getRules()) {
    rule.delete();
  }
  egressChain.addRule().type(DtoRule.Accept).matchForwardFlow(true).position(1).create();
}
Program: 106240
Project: 106240
Buggy source:
public boolean midoInNetwork(Network network){
  for (  String pname : _ntwkSrvcDao.getDistinctProviders(network.getId())) {
    if (pname.equals(getProvider().getName())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean midoInNetwork(Network network){
  if ((network.getTrafficType() == Networks.TrafficType.Public) && (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Mido)) {
    return true;
  }
  if ((network.getTrafficType() == Networks.TrafficType.Guest) && (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Mido)) {
    return true;
  }
  return false;
}
Program: 106241
Project: 106241
Buggy source:
protected RuleChain getOrInitEgressACLFilter(Network network){
  boolean isVpc=getIsVpc(network);
  long id=getRouterId(network,isVpc);
  String routerName=getRouterName(isVpc,id);
  RuleChain egressChain=getChain(String.valueOf(network.getId()),String.valueOf(network.getAccountId()),routerName,RuleChainCode.ACL_EGRESS);
  int totalRules=0;
  for (  Rule rule : egressChain.getRules()) {
    if (rule.getNwProto() != 0) {
      totalRules++;
    }
  }
  if (totalRules > 0) {
    return egressChain;
  }
 else {
    for (    Rule rule : egressChain.getRules()) {
      rule.delete();
    }
  }
  int pos=1;
  egressChain.addRule().type(DtoRule.Accept).dlType((short)0x0806).position(pos++).create();
  egressChain.addRule().type(DtoRule.Drop).position(pos).create();
  return egressChain;
}

Fixed version (ground truth):
protected RuleChain getOrInitEgressACLFilter(Network network){
  boolean isVpc=getIsVpc(network);
  long id=getRouterId(network,isVpc);
  String routerName=getRouterName(isVpc,id);
  RuleChain egressChain=getChain(String.valueOf(network.getId()),getAccountUuid(network),routerName,RuleChainCode.ACL_EGRESS);
  int totalRules=0;
  for (  Rule rule : egressChain.getRules()) {
    if (rule.getNwProto() != 0) {
      totalRules++;
    }
  }
  if (totalRules > 0) {
    return egressChain;
  }
 else {
    for (    Rule rule : egressChain.getRules()) {
      rule.delete();
    }
  }
  int pos=1;
  egressChain.addRule().type(DtoRule.Accept).dlType((short)0x0806).position(pos++).create();
  egressChain.addRule().type(DtoRule.Accept).nwProto(SimpleFirewallRule.stringToProtocolNumber("String_Node_Str")).nwDstAddress(network.getGateway()).nwDstLength(32).position(pos++).create();
  egressChain.addRule().type(DtoRule.Drop).position(pos).create();
  return egressChain;
}
Program: 106242
Project: 106242
Buggy source:
private Bridge getNetworkBridge(long networkID,long accountID){
  MultivaluedMap qNetBridge=new MultivaluedMapImpl();
  String accountIdStr=String.valueOf(accountID);
  String networkUUIDStr=String.valueOf(networkID);
  qNetBridge.add("String_Node_Str",accountIdStr);
  for (  Bridge b : this.api.getBridges(qNetBridge)) {
    if (b.getName().equals(networkUUIDStr)) {
      return b;
    }
  }
  return null;
}

Fixed version (ground truth):
private Bridge getNetworkBridge(long networkID,String accountUuid){
  MultivaluedMap qNetBridge=new MultivaluedMapImpl();
  String networkUUIDStr=String.valueOf(networkID);
  qNetBridge.add("String_Node_Str",accountUuid);
  for (  Bridge b : this.api.getBridges(qNetBridge)) {
    if (b.getName().equals(networkUUIDStr)) {
      return b;
    }
  }
  return null;
}
Program: 106243
Project: 106243
Buggy source:
protected Router createRouter(long id,long accountID,boolean isVpc){
  String accountIdStr=String.valueOf(accountID);
  String routerName=getRouterName(isVpc,id);
  RuleChain pre=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PRE)).tenantId(accountIdStr).create();
  RuleChain post=api.addChain().name(getChainName(routerName,RuleChainCode.TR_POST)).tenantId(accountIdStr).create();
  RuleChain preFilter=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PREFILTER)).tenantId(accountIdStr).create();
  RuleChain preNat=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PRENAT)).tenantId(accountIdStr).create();
  pre.addRule().type(DtoRule.Jump).jumpChainId(preFilter.getId()).position(1).create();
  pre.addRule().type(DtoRule.Jump).jumpChainId(preNat.getId()).position(2).create();
  return api.addRouter().tenantId(accountIdStr).name(routerName).inboundFilterId(pre.getId()).outboundFilterId(post.getId()).create();
}

Fixed version (ground truth):
protected Router createRouter(long id,String accountUuid,boolean isVpc){
  String routerName=getRouterName(isVpc,id);
  RuleChain pre=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PRE)).tenantId(accountUuid).create();
  RuleChain post=api.addChain().name(getChainName(routerName,RuleChainCode.TR_POST)).tenantId(accountUuid).create();
  RuleChain preFilter=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PREFILTER)).tenantId(accountUuid).create();
  RuleChain preNat=api.addChain().name(getChainName(routerName,RuleChainCode.TR_PRENAT)).tenantId(accountUuid).create();
  pre.addRule().type(DtoRule.Jump).jumpChainId(preFilter.getId()).position(1).create();
  pre.addRule().type(DtoRule.Jump).jumpChainId(preNat.getId()).position(2).create();
  return api.addRouter().tenantId(accountUuid).name(routerName).inboundFilterId(pre.getId()).outboundFilterId(post.getId()).create();
}
Program: 106244
Project: 106244
Buggy source:
private Bridge getOrCreateNetworkBridge(long networkID,long accountID){
  Bridge netBridge=getNetworkBridge(networkID,accountID);
  if (netBridge == null) {
    String accountIdStr=String.valueOf(accountID);
    String networkUUIDStr=String.valueOf(networkID);
    netBridge=api.addBridge().tenantId(accountIdStr).name(networkUUIDStr).create();
  }
  return netBridge;
}

Fixed version (ground truth):
private Bridge getOrCreateNetworkBridge(long networkID,String accountUuid){
  Bridge netBridge=getNetworkBridge(networkID,accountUuid);
  if (netBridge == null) {
    String networkUUIDStr=String.valueOf(networkID);
    netBridge=api.addBridge().tenantId(accountUuid).name(networkUUIDStr).create();
  }
  return netBridge;
}
Program: 106245
Project: 106245
Buggy source:
protected Answer copyVolumeFromSnapshot(DataObject snapObj,DataObject volObj){
  SnapshotInfo snapshot=(SnapshotInfo)snapObj;
  StoragePool pool=(StoragePool)volObj.getDataStore();
  String basicErrMsg="String_Node_Str" + snapshot.getName() + "String_Node_Str"+ pool;
  DataStore store=snapObj.getDataStore();
  DataStoreTO storTO=store.getTO();
  DataObject srcData=snapObj;
  try {
    if (!(storTO instanceof NfsTO)) {
      srcData=cacheSnapshotChain(snapshot);
    }
    String value=configDao.getValue(Config.CreateVolumeFromSnapshotWait.toString());
    int _createVolumeFromSnapshotWait=NumbersUtil.parseInt(value,Integer.parseInt(Config.CreateVolumeFromSnapshotWait.getDefaultValue()));
    CopyCommand cmd=new CopyCommand(srcData.getTO(),volObj.getTO(),_createVolumeFromSnapshotWait);
    Answer answer=storageMgr.sendToPool(pool,cmd);
    return answer;
  }
 catch (  StorageUnavailableException e) {
    s_logger.error(basicErrMsg,e);
    throw new CloudRuntimeException(basicErrMsg);
  }
 finally {
    if (!(storTO instanceof NfsTO)) {
      deleteSnapshotCacheChain((SnapshotInfo)srcData);
    }
  }
}

Fixed version (ground truth):
protected Answer copyVolumeFromSnapshot(DataObject snapObj,DataObject volObj){
  SnapshotInfo snapshot=(SnapshotInfo)snapObj;
  StoragePool pool=(StoragePool)volObj.getDataStore();
  String basicErrMsg="String_Node_Str" + snapshot.getName() + "String_Node_Str"+ pool;
  DataStore store=snapObj.getDataStore();
  DataStoreTO storTO=store.getTO();
  DataObject srcData=snapObj;
  try {
    if (!(storTO instanceof NfsTO)) {
      srcData=cacheSnapshotChain(snapshot);
    }
    String value=configDao.getValue(Config.CreateVolumeFromSnapshotWait.toString());
    int _createVolumeFromSnapshotWait=NumbersUtil.parseInt(value,Integer.parseInt(Config.CreateVolumeFromSnapshotWait.getDefaultValue()));
    CopyCommand cmd=new CopyCommand(srcData.getTO(),volObj.getTO(),_createVolumeFromSnapshotWait);
    EndPoint ep=selector.select(snapObj,volObj);
    Answer answer=ep.sendMessage(cmd);
    return answer;
  }
 catch (  Exception e) {
    s_logger.error(basicErrMsg,e);
    throw new CloudRuntimeException(basicErrMsg);
  }
 finally {
    if (!(storTO instanceof NfsTO)) {
      deleteSnapshotCacheChain((SnapshotInfo)srcData);
    }
  }
}
Program: 106246
Project: 106246
Buggy source:
@Test public void createTemplateFromSnapshot(){
  VolumeInfo vol=createCopyBaseImage();
  SnapshotVO snapshotVO=createSnapshotInDb(vol);
  SnapshotInfo snapshot=this.snapshotFactory.getSnapshot(snapshotVO.getId(),vol.getDataStore());
  boolean result=false;
  for (  SnapshotStrategy strategy : this.snapshotStrategies) {
    if (strategy.canHandle(snapshot)) {
      snapshot=strategy.takeSnapshot(snapshot);
      result=true;
    }
  }
  AssertJUnit.assertTrue(result);
  LocalHostEndpoint ep=new LocalHostEndpoint();
  ep.setResource(new MockLocalNfsSecondaryStorageResource());
  Mockito.when(epSelector.select(Mockito.any(DataObject.class),Mockito.any(DataObject.class))).thenReturn(ep);
  VMTemplateVO templateVO=createTemplateInDb();
  TemplateInfo tmpl=this.templateFactory.getTemplate(templateVO.getId(),DataStoreRole.Image);
  DataStore imageStore=this.dataStoreMgr.getImageStore(this.dcId);
  this.imageService.createTemplateFromSnapshotAsync(snapshot,tmpl,imageStore);
}

Fixed version (ground truth):
public void createTemplateFromSnapshot(){
  VolumeInfo vol=createCopyBaseImage();
  SnapshotVO snapshotVO=createSnapshotInDb(vol);
  SnapshotInfo snapshot=this.snapshotFactory.getSnapshot(snapshotVO.getId(),vol.getDataStore());
  boolean result=false;
  for (  SnapshotStrategy strategy : this.snapshotStrategies) {
    if (strategy.canHandle(snapshot)) {
      snapshot=strategy.takeSnapshot(snapshot);
      result=true;
    }
  }
  AssertJUnit.assertTrue(result);
  LocalHostEndpoint ep=new LocalHostEndpoint();
  ep.setResource(new MockLocalNfsSecondaryStorageResource());
  Mockito.when(epSelector.select(Mockito.any(DataObject.class),Mockito.any(DataObject.class))).thenReturn(ep);
  VMTemplateVO templateVO=createTemplateInDb();
  TemplateInfo tmpl=this.templateFactory.getTemplate(templateVO.getId(),DataStoreRole.Image);
  DataStore imageStore=this.dataStoreMgr.getImageStore(this.dcId);
  this.imageService.createTemplateFromSnapshotAsync(snapshot,tmpl,imageStore);
}
Program: 106247
Project: 106247
Buggy source:
@Test public void createSnapshot(){
  VolumeInfo vol=createCopyBaseImage();
  SnapshotVO snapshotVO=createSnapshotInDb(vol);
  SnapshotInfo snapshot=this.snapshotFactory.getSnapshot(snapshotVO.getId(),vol.getDataStore());
  for (  SnapshotStrategy strategy : this.snapshotStrategies) {
    if (strategy.canHandle(snapshot)) {
      strategy.takeSnapshot(snapshot);
    }
  }
}

Fixed version (ground truth):
public void createSnapshot(){
  VolumeInfo vol=createCopyBaseImage();
  SnapshotVO snapshotVO=createSnapshotInDb(vol);
  SnapshotInfo snapshot=this.snapshotFactory.getSnapshot(snapshotVO.getId(),vol.getDataStore());
  for (  SnapshotStrategy strategy : this.snapshotStrategies) {
    if (strategy.canHandle(snapshot)) {
      strategy.takeSnapshot(snapshot);
    }
  }
}
Program: 106248
Project: 106248
Buggy source:
protected Void createVolumeFromSnapshotCallback(AsyncCallbackDispatcher<VolumeServiceImpl,CopyCommandResult> callback,CreateVolumeFromBaseImageContext<VolumeApiResult> context){
  CopyCommandResult result=callback.getResult();
  VolumeInfo volume=(VolumeInfo)context.vo;
  SnapshotInfo snapshot=context.snapshot;
  VolumeApiResult apiResult=new VolumeApiResult(volume);
  Event event=null;
  if (result.isFailed()) {
    apiResult.setResult(result.getResult());
    event=Event.OperationFailed;
  }
 else {
    event=Event.OperationSuccessed;
  }
  try {
    volume.processEvent(event);
    snapshot.processEvent(event);
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
    apiResult.setResult(e.toString());
  }
  AsyncCallFuture<VolumeApiResult> future=context.future;
  future.complete(apiResult);
  return null;
}

Fixed version (ground truth):
protected Void createVolumeFromSnapshotCallback(AsyncCallbackDispatcher<VolumeServiceImpl,CopyCommandResult> callback,CreateVolumeFromBaseImageContext<VolumeApiResult> context){
  CopyCommandResult result=callback.getResult();
  VolumeInfo volume=(VolumeInfo)context.vo;
  SnapshotInfo snapshot=context.snapshot;
  VolumeApiResult apiResult=new VolumeApiResult(volume);
  Event event=null;
  if (result.isFailed()) {
    apiResult.setResult(result.getResult());
    event=Event.OperationFailed;
  }
 else {
    event=Event.OperationSuccessed;
  }
  try {
    if (result.isSuccess()) {
      volume.processEvent(event,result.getAnswer());
    }
 else {
      volume.processEvent(event);
    }
    snapshot.processEvent(event);
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
    apiResult.setResult(e.toString());
  }
  AsyncCallFuture<VolumeApiResult> future=context.future;
  future.complete(apiResult);
  return null;
}
Program: 106253
Project: 106253
Buggy source:
public TemplateProp getTemplateInfo(){
  TemplateProp tmplInfo=new TemplateProp();
  tmplInfo.id=Long.parseLong(_props.getProperty("String_Node_Str"));
  tmplInfo.installPath=_templatePath + File.separator + _props.getProperty("String_Node_Str");
  if (_resourceType == ResourceType.VOLUME) {
    tmplInfo.installPath=tmplInfo.installPath.substring(tmplInfo.installPath.indexOf("String_Node_Str"));
  }
 else {
    tmplInfo.installPath=tmplInfo.installPath.substring(tmplInfo.installPath.indexOf("String_Node_Str"));
  }
  tmplInfo.isCorrupted=_isCorrupted;
  tmplInfo.isPublic=Boolean.parseBoolean(_props.getProperty("String_Node_Str"));
  tmplInfo.templateName=_props.getProperty("String_Node_Str");
  tmplInfo.size=Long.parseLong(_props.getProperty("String_Node_Str"));
  tmplInfo.physicalSize=Long.parseLong(_props.getProperty("String_Node_Str"));
  return tmplInfo;
}

Fixed version (ground truth):
public TemplateProp getTemplateInfo(){
  TemplateProp tmplInfo=new TemplateProp();
  tmplInfo.id=Long.parseLong(_props.getProperty("String_Node_Str"));
  tmplInfo.installPath=_templatePath + File.separator + _props.getProperty("String_Node_Str");
  if (_resourceType == ResourceType.VOLUME) {
    tmplInfo.installPath=tmplInfo.installPath.substring(tmplInfo.installPath.indexOf("String_Node_Str"));
  }
 else {
    tmplInfo.installPath=tmplInfo.installPath.substring(tmplInfo.installPath.indexOf("String_Node_Str"));
  }
  tmplInfo.isCorrupted=_isCorrupted;
  tmplInfo.isPublic=Boolean.parseBoolean(_props.getProperty("String_Node_Str"));
  tmplInfo.templateName=_props.getProperty("String_Node_Str");
  if (_props.getProperty("String_Node_Str") != null) {
    tmplInfo.size=Long.parseLong(_props.getProperty("String_Node_Str"));
  }
  if (_props.getProperty("String_Node_Str") != null) {
    tmplInfo.physicalSize=Long.parseLong(_props.getProperty("String_Node_Str"));
  }
  return tmplInfo;
}
Program: 106255
Project: 106255
Buggy source:
@Override public List<ImageStoreVO> findByScope(ZoneScope scope){
  SearchCriteria<ImageStoreVO> sc=createSearchCriteria();
  sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,DataStoreRole.Image);
  SearchCriteria<ImageStoreVO> scc=createSearchCriteria();
  scc.addOr("String_Node_Str",SearchCriteria.Op.EQ,ScopeType.REGION);
  scc.addOr("String_Node_Str",SearchCriteria.Op.EQ,scope.getScopeId());
  sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,scc);
  return listBy(sc);
}

Fixed version (ground truth):
@Override public List<ImageStoreVO> findByScope(ZoneScope scope){
  SearchCriteria<ImageStoreVO> sc=createSearchCriteria();
  sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,DataStoreRole.Image);
  if (scope.getScopeId() != null) {
    SearchCriteria<ImageStoreVO> scc=createSearchCriteria();
    scc.addOr("String_Node_Str",SearchCriteria.Op.EQ,ScopeType.REGION);
    scc.addOr("String_Node_Str",SearchCriteria.Op.EQ,scope.getScopeId());
    sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,scc);
  }
  return listBy(sc);
}
Program: 106256
Project: 106256
Buggy source:
public LocalNfsSecondaryStorageResource(){
  this._dlMgr=new DownloadManagerImpl();
  ((DownloadManagerImpl)_dlMgr).setThreadPool(Executors.newFixedThreadPool(10));
}

Fixed version (ground truth):
public LocalNfsSecondaryStorageResource(){
  this._dlMgr=new DownloadManagerImpl();
  ((DownloadManagerImpl)_dlMgr).setThreadPool(Executors.newFixedThreadPool(10));
  _storage=new JavaStorageLayer();
  this._inSystemVM=false;
}
Program: 106257
Project: 106257
Buggy source:
public HostScope(Long hostId){
  this.hostId=hostId;
}

Fixed version (ground truth):
public HostScope(Long hostId,Long zoneId){
  this.hostId=hostId;
  this.zoneId=zoneId;
}
Program: 106258
Project: 106258
Buggy source:
@Test public void testHostScope(){
  HostScope hostScope=new HostScope(1L);
  HostScope hostScope2=new HostScope(1L);
  HostScope hostScope3=new HostScope(2L);
  Assert.assertTrue(hostScope.isSameScope(hostScope2));
  Assert.assertFalse(hostScope.isSameScope(hostScope3));
}

Fixed version (ground truth):
@Test public void testHostScope(){
  HostScope hostScope=new HostScope(1L,1L);
  HostScope hostScope2=new HostScope(1L,1L);
  HostScope hostScope3=new HostScope(2L,1L);
  Assert.assertTrue(hostScope.isSameScope(hostScope2));
  Assert.assertFalse(hostScope.isSameScope(hostScope3));
}
Program: 106259
Project: 106259
Buggy source:
@DB protected Answer copyVolumeFromImage(DataObject srcData,DataObject destData){
  String value=configDao.getValue(Config.CopyVolumeWait.key());
  int _copyvolumewait=NumbersUtil.parseInt(value,Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
  if (needCacheStorage(srcData,destData)) {
    DataObject cacheData=cacheMgr.createCacheObject(srcData,destData.getDataStore().getScope());
    CopyCommand cmd=new CopyCommand(cacheData.getTO(),destData.getTO(),_copyvolumewait);
    EndPoint ep=selector.select(cacheData,destData);
    Answer answer=ep.sendMessage(cmd);
    return answer;
  }
 else {
    CopyCommand cmd=new CopyCommand(srcData.getTO(),destData.getTO(),_copyvolumewait);
    EndPoint ep=selector.select(srcData,destData);
    Answer answer=ep.sendMessage(cmd);
    return answer;
  }
}

Fixed version (ground truth):
@DB protected Answer copyVolumeFromImage(DataObject srcData,DataObject destData){
  String value=configDao.getValue(Config.CopyVolumeWait.key());
  int _copyvolumewait=NumbersUtil.parseInt(value,Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
  if (needCacheStorage(srcData,destData)) {
    Scope destScope=destData.getDataStore().getScope();
    if (destScope instanceof ClusterScope) {
      ClusterScope clusterScope=(ClusterScope)destScope;
      destScope=new ZoneScope(clusterScope.getZoneId());
    }
 else     if (destScope instanceof HostScope) {
      HostScope hostScope=(HostScope)destScope;
      destScope=new ZoneScope(hostScope.getZoneId());
    }
    DataObject cacheData=cacheMgr.createCacheObject(srcData,destScope);
    CopyCommand cmd=new CopyCommand(cacheData.getTO(),destData.getTO(),_copyvolumewait);
    EndPoint ep=selector.select(cacheData,destData);
    Answer answer=ep.sendMessage(cmd);
    return answer;
  }
 else {
    CopyCommand cmd=new CopyCommand(srcData.getTO(),destData.getTO(),_copyvolumewait);
    EndPoint ep=selector.select(srcData,destData);
    Answer answer=ep.sendMessage(cmd);
    return answer;
  }
}
Program: 106260
Project: 106260
Buggy source:
private Answer copyTemplate(DataObject srcData,DataObject destData){
  String value=configDao.getValue(Config.PrimaryStorageDownloadWait.toString());
  int _primaryStorageDownloadWait=NumbersUtil.parseInt(value,Integer.parseInt(Config.PrimaryStorageDownloadWait.getDefaultValue()));
  if (needCacheStorage(srcData,destData)) {
    DataObject cacheData=cacheMgr.createCacheObject(srcData,destData.getDataStore().getScope());
    CopyCommand cmd=new CopyCommand(cacheData.getTO(),destData.getTO(),_primaryStorageDownloadWait);
    EndPoint ep=selector.select(cacheData,destData);
    Answer answer=ep.sendMessage(cmd);
    return answer;
  }
 else {
    CopyCommand cmd=new CopyCommand(srcData.getTO(),destData.getTO(),_primaryStorageDownloadWait);
    EndPoint ep=selector.select(srcData,destData);
    Answer answer=ep.sendMessage(cmd);
    return answer;
  }
}

Fixed version (ground truth):
private Answer copyTemplate(DataObject srcData,DataObject destData){
  String value=configDao.getValue(Config.PrimaryStorageDownloadWait.toString());
  int _primaryStorageDownloadWait=NumbersUtil.parseInt(value,Integer.parseInt(Config.PrimaryStorageDownloadWait.getDefaultValue()));
  if (needCacheStorage(srcData,destData)) {
    Scope destScope=destData.getDataStore().getScope();
    if (destScope instanceof ClusterScope) {
      ClusterScope clusterScope=(ClusterScope)destScope;
      destScope=new ZoneScope(clusterScope.getZoneId());
    }
 else     if (destScope instanceof HostScope) {
      HostScope hostScope=(HostScope)destScope;
      destScope=new ZoneScope(hostScope.getZoneId());
    }
    DataObject cacheData=cacheMgr.createCacheObject(srcData,destScope);
    CopyCommand cmd=new CopyCommand(cacheData.getTO(),destData.getTO(),_primaryStorageDownloadWait);
    EndPoint ep=selector.select(cacheData,destData);
    Answer answer=ep.sendMessage(cmd);
    return answer;
  }
 else {
    CopyCommand cmd=new CopyCommand(srcData.getTO(),destData.getTO(),_primaryStorageDownloadWait);
    EndPoint ep=selector.select(srcData,destData);
    Answer answer=ep.sendMessage(cmd);
    return answer;
  }
}
Program: 106262
Project: 106262
Buggy source:
@Override public Scope getScope(){
  StoragePoolVO vo=dataStoreDao.findById(this.pdsv.getId());
  if (vo.getScope() == ScopeType.CLUSTER) {
    return new ClusterScope(vo.getClusterId(),vo.getPodId(),vo.getDataCenterId());
  }
 else   if (vo.getScope() == ScopeType.ZONE) {
    return new ZoneScope(vo.getDataCenterId());
  }
 else   if (vo.getScope() == ScopeType.HOST) {
    List<StoragePoolHostVO> poolHosts=poolHostDao.listByPoolId(vo.getId());
    if (poolHosts.size() > 0) {
      return new HostScope(poolHosts.get(0).getHostId());
    }
    s_logger.debug("String_Node_Str" + vo.getId());
  }
  return null;
}

Fixed version (ground truth):
@Override public Scope getScope(){
  StoragePoolVO vo=dataStoreDao.findById(this.pdsv.getId());
  if (vo.getScope() == ScopeType.CLUSTER) {
    return new ClusterScope(vo.getClusterId(),vo.getPodId(),vo.getDataCenterId());
  }
 else   if (vo.getScope() == ScopeType.ZONE) {
    return new ZoneScope(vo.getDataCenterId());
  }
 else   if (vo.getScope() == ScopeType.HOST) {
    List<StoragePoolHostVO> poolHosts=poolHostDao.listByPoolId(vo.getId());
    if (poolHosts.size() > 0) {
      return new HostScope(poolHosts.get(0).getHostId(),vo.getDataCenterId());
    }
    s_logger.debug("String_Node_Str" + vo.getId());
  }
  return null;
}