nus-yam/ex-repair huggingface dataset:
Program: 106610
Project: 106610
Buggy source:
String swiftUpload(SwiftTO swift,String container,String lDir,String lFilename){
  Script command=new Script("String_Node_Str",s_logger);
  command.add("String_Node_Str");
  command.add("String_Node_Str" + lDir + "String_Node_Str"+ swift.getUrl()+ "String_Node_Str"+ swift.getAccount()+ "String_Node_Str"+ swift.getUserName()+ "String_Node_Str"+ swift.getKey()+ "String_Node_Str"+ container+ "String_Node_Str"+ lFilename);
  String result=command.execute();
  if (result != null) {
    String errMsg="String_Node_Str" + result;
    s_logger.warn(errMsg);
    return errMsg;
  }
  return null;
}

Fixed version (ground truth):
String swiftUpload(SwiftTO swift,String container,String lDir,String lFilename){
  Script command=new Script("String_Node_Str",s_logger);
  command.add("String_Node_Str");
  command.add("String_Node_Str" + lDir + "String_Node_Str"+ swift.getUrl()+ "String_Node_Str"+ swift.getAccount()+ "String_Node_Str"+ swift.getUserName()+ "String_Node_Str"+ swift.getKey()+ "String_Node_Str"+ container+ "String_Node_Str"+ lFilename);
  OutputInterpreter.AllLinesParser parser=new OutputInterpreter.AllLinesParser();
  String result=command.execute(parser);
  if (result != null) {
    String errMsg="String_Node_Str" + result;
    s_logger.warn(errMsg);
    return errMsg;
  }
  if (parser.getLines() != null) {
    String[] lines=parser.getLines().split("String_Node_Str");
    for (    String line : lines) {
      if (line.contains("String_Node_Str")) {
        String errMsg="String_Node_Str" + lines.toString();
        s_logger.warn(errMsg);
        return errMsg;
      }
    }
  }
  return null;
}
Program: 106611
Project: 106611
Buggy source:
String swiftDelete(SwiftTO swift,String container,String rFilename){
  Script command=new Script("String_Node_Str",s_logger);
  command.add("String_Node_Str");
  command.add("String_Node_Str" + swift.getUrl() + "String_Node_Str"+ swift.getAccount()+ "String_Node_Str"+ swift.getUserName()+ "String_Node_Str"+ swift.getKey()+ "String_Node_Str"+ container+ "String_Node_Str"+ rFilename);
  String result=command.execute();
  if (result != null) {
    String errMsg="String_Node_Str" + result;
    s_logger.warn(errMsg);
    return errMsg;
  }
  return null;
}

Fixed version (ground truth):
String swiftDelete(SwiftTO swift,String container,String rFilename){
  Script command=new Script("String_Node_Str",s_logger);
  command.add("String_Node_Str");
  command.add("String_Node_Str" + swift.getUrl() + "String_Node_Str"+ swift.getAccount()+ "String_Node_Str"+ swift.getUserName()+ "String_Node_Str"+ swift.getKey()+ "String_Node_Str"+ container+ "String_Node_Str"+ rFilename);
  OutputInterpreter.AllLinesParser parser=new OutputInterpreter.AllLinesParser();
  String result=command.execute(parser);
  if (result != null) {
    String errMsg="String_Node_Str" + result;
    s_logger.warn(errMsg);
    return errMsg;
  }
  if (parser.getLines() != null) {
    String[] lines=parser.getLines().split("String_Node_Str");
    for (    String line : lines) {
      if (line.contains("String_Node_Str")) {
        String errMsg="String_Node_Str" + lines.toString();
        s_logger.warn(errMsg);
        return errMsg;
      }
    }
  }
  return null;
}
Program: 106613
Project: 106613
Buggy source:
protected HashMap<String,Pair<String,State>> fullClusterSync(Connection conn){
  XenServerPoolVms vms=new XenServerPoolVms();
  try {
    Host lhost=Host.getByUuid(conn,_host.uuid);
    Map<VM,VM.Record> vm_map=VM.getAllRecords(conn);
    for (    VM.Record record : vm_map.values()) {
      if (record.isControlDomain || record.isASnapshot || record.isATemplate) {
        continue;
      }
      String vm_name=record.nameLabel;
      VmPowerState ps=record.powerState;
      final State state=convertToState(ps);
      Host host=record.residentOn;
      String host_uuid=null;
      if (!isRefNull(host)) {
        host_uuid=host.getUuid(conn);
        vms.put(_cluster,host_uuid,vm_name,state);
      }
      if (s_logger.isTraceEnabled()) {
        s_logger.trace("String_Node_Str" + vm_name + "String_Node_Str"+ ps+ "String_Node_Str"+ state.toString());
      }
    }
  }
 catch (  final Throwable e) {
    String msg="String_Node_Str" + _host.uuid + "String_Node_Str"+ e.toString();
    s_logger.warn(msg,e);
    throw new CloudRuntimeException(msg);
  }
  return vms.getClusterVmState(_cluster);
}

Fixed version (ground truth):
protected HashMap<String,Pair<String,State>> fullClusterSync(Connection conn){
  XenServerPoolVms vms=new XenServerPoolVms();
  try {
    Map<VM,VM.Record> vm_map=VM.getAllRecords(conn);
    for (    VM.Record record : vm_map.values()) {
      if (record.isControlDomain || record.isASnapshot || record.isATemplate) {
        continue;
      }
      String vm_name=record.nameLabel;
      VmPowerState ps=record.powerState;
      final State state=convertToState(ps);
      Host host=record.residentOn;
      String host_uuid=null;
      if (!isRefNull(host)) {
        host_uuid=host.getUuid(conn);
        vms.put(_cluster,host_uuid,vm_name,state);
      }
      if (s_logger.isTraceEnabled()) {
        s_logger.trace("String_Node_Str" + vm_name + "String_Node_Str"+ ps+ "String_Node_Str"+ state.toString());
      }
    }
  }
 catch (  final Throwable e) {
    String msg="String_Node_Str" + _host.uuid + "String_Node_Str"+ e.toString();
    s_logger.warn(msg,e);
    throw new CloudRuntimeException(msg);
  }
  return vms.getClusterVmState(_cluster);
}
Program: 106616
Project: 106616
Buggy source:
public Commands fullSync(final long clusterId,Map<String,Pair<String,State>> newStates){
  Commands commands=new Commands(OnError.Continue);
  Map<Long,AgentVmInfo> infos=convertToInfos(newStates);
  long hId=0;
  final List<VMInstanceVO> vms=_vmDao.listByClusterId(clusterId);
  for (  VMInstanceVO vm : vms) {
    AgentVmInfo info=infos.remove(vm.getId());
  }
  for (  final AgentVmInfo left : infos.values()) {
    s_logger.warn("String_Node_Str" + left.name);
    commands.addCommand(cleanup(left.name));
  }
  return commands;
}

Fixed version (ground truth):
public void fullSync(final long clusterId,Map<String,Pair<String,State>> newStates){
  Map<Long,AgentVmInfo> infos=convertToInfos(newStates);
  List<VMInstanceVO> vms=_vmDao.listByClusterId(clusterId);
  for (  VMInstanceVO vm : vms) {
    if (vm.isRemoved() || vm.getState() == State.Destroyed || vm.getState() == State.Expunging)     continue;
    infos.remove(vm.getId());
  }
  vms=_vmDao.listStartingByClusterId(clusterId);
  for (  VMInstanceVO vm : vms) {
    if (vm.isRemoved() || vm.getState() == State.Destroyed || vm.getState() == State.Expunging)     continue;
    infos.remove(vm.getId());
  }
  for (  final AgentVmInfo left : infos.values()) {
    try {
      Host host=_resourceMgr.findHostByGuid(left.getHostUuid());
      if (host != null) {
        s_logger.warn("String_Node_Str" + left.name);
        Answer answer=_agentMgr.send(host.getId(),cleanup(left.name));
        if (!answer.getResult()) {
          s_logger.warn("String_Node_Str" + answer.getDetails());
        }
      }
    }
 catch (    Exception e) {
      s_logger.warn("String_Node_Str" + e.getMessage());
    }
  }
}
Program: 106617
Project: 106617
Buggy source:
public Commands deltaSync(Map<String,Pair<String,State>> newStates){
  Map<Long,AgentVmInfo> states=convertToInfos(newStates);
  Commands commands=new Commands(OnError.Continue);
  for (  Map.Entry<Long,AgentVmInfo> entry : states.entrySet()) {
    AgentVmInfo info=entry.getValue();
    VMInstanceVO vm=info.vm;
    Command command=null;
    if (vm != null) {
      String hostGuid=info.getHostUuid();
      Host host=_resourceMgr.findHostByGuid(hostGuid);
      long hId=host.getId();
      HypervisorGuru hvGuru=_hvGuruMgr.getGuru(vm.getHypervisorType());
      command=compareState(hId,vm,info,false,hvGuru.trackVmHostChange());
    }
 else {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + info.name);
      }
      command=cleanup(info.name);
    }
    if (command != null) {
      commands.addCommand(command);
    }
  }
  return commands;
}

Fixed version (ground truth):
public void deltaSync(Map<String,Pair<String,State>> newStates){
  Map<Long,AgentVmInfo> states=convertToInfos(newStates);
  for (  Map.Entry<Long,AgentVmInfo> entry : states.entrySet()) {
    AgentVmInfo info=entry.getValue();
    VMInstanceVO vm=info.vm;
    Command command=null;
    if (vm != null) {
      Host host=_resourceMgr.findHostByGuid(info.getHostUuid());
      long hId=host.getId();
      HypervisorGuru hvGuru=_hvGuruMgr.getGuru(vm.getHypervisorType());
      command=compareState(hId,vm,info,false,hvGuru.trackVmHostChange());
    }
 else {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + info.name);
      }
      command=cleanup(info.name);
    }
    if (command != null) {
      try {
        Host host=_resourceMgr.findHostByGuid(info.getHostUuid());
        if (host != null) {
          Answer answer=_agentMgr.send(host.getId(),cleanup(info.name));
          if (!answer.getResult()) {
            s_logger.warn("String_Node_Str" + answer.getDetails());
          }
        }
      }
 catch (      Exception e) {
        s_logger.warn("String_Node_Str" + e.getMessage());
      }
    }
  }
}
Program: 106618
Project: 106618
Buggy source:
@Override public boolean processAnswers(long agentId,long seq,Answer[] answers){
  for (  final Answer answer : answers) {
    if (answer instanceof ClusterSyncAnswer) {
      ClusterSyncAnswer hs=(ClusterSyncAnswer)answer;
      if (hs.isFull()) {
        deltaSync(hs.getNewStates());
        fullSync(hs.getClusterId(),hs.getAllStates());
      }
 else       if (hs.isDelta()) {
        deltaSync(hs.getNewStates());
      }
    }
 else     if (!answer.getResult()) {
      s_logger.warn("String_Node_Str" + answer.getDetails());
    }
 else {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + answer.getDetails());
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean processAnswers(long agentId,long seq,Answer[] answers){
  for (  final Answer answer : answers) {
    if (answer instanceof ClusterSyncAnswer) {
      ClusterSyncAnswer hs=(ClusterSyncAnswer)answer;
      if (!hs.isExceuted()) {
        if (hs.isFull()) {
          deltaSync(hs.getNewStates());
          fullSync(hs.getClusterId(),hs.getAllStates());
        }
 else         if (hs.isDelta()) {
          deltaSync(hs.getNewStates());
        }
        hs.setExecuted();
      }
    }
 else     if (!answer.getResult()) {
      s_logger.warn("String_Node_Str" + answer.getDetails());
    }
 else {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + answer.getDetails());
      }
    }
  }
  return true;
}
Program: 106620
Project: 106620
Buggy source:
private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb,String keyword,Long id,Boolean isSystem,Long zoneId,String guestIpType,String trafficType,Long physicalNetworkId,String aclType){
  SearchCriteria<NetworkVO> sc=sb.create();
  if (isSystem != null) {
    sc.setJoinParameters("String_Node_Str","String_Node_Str",isSystem);
  }
  if (keyword != null) {
    SearchCriteria<NetworkVO> ssc=_networksDao.createSearchCriteria();
    ssc.addOr("String_Node_Str",SearchCriteria.Op.LIKE,"String_Node_Str" + keyword + "String_Node_Str");
    sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,ssc);
  }
  if (id != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,id);
  }
  if (zoneId != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,zoneId);
  }
  if (guestIpType != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,guestIpType);
  }
  if (trafficType != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,trafficType);
  }
  if (aclType != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,aclType.toString());
  }
  if (physicalNetworkId != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,physicalNetworkId);
  }
  return sc;
}

Fixed version (ground truth):
private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb,String keyword,Long id,Boolean isSystem,Long zoneId,String guestIpType,String trafficType,Long physicalNetworkId,String aclType,boolean skipProjectNetworks){
  SearchCriteria<NetworkVO> sc=sb.create();
  if (isSystem != null) {
    sc.setJoinParameters("String_Node_Str","String_Node_Str",isSystem);
  }
  if (keyword != null) {
    SearchCriteria<NetworkVO> ssc=_networksDao.createSearchCriteria();
    ssc.addOr("String_Node_Str",SearchCriteria.Op.LIKE,"String_Node_Str" + keyword + "String_Node_Str");
    sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,ssc);
  }
  if (id != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,id);
  }
  if (zoneId != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,zoneId);
  }
  if (guestIpType != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,guestIpType);
  }
  if (trafficType != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,trafficType);
  }
  if (aclType != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,aclType.toString());
  }
  if (physicalNetworkId != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,physicalNetworkId);
  }
  if (skipProjectNetworks) {
    sc.setJoinParameters("String_Node_Str","String_Node_Str",Account.ACCOUNT_TYPE_PROJECT);
  }
  return sc;
}
Program: 106625
Project: 106625
Buggy source:
@Override public String getConsoleAccessUrlRoot(long vmId){
  VMInstanceVO vm=_vmMgr.findById(vmId);
  if (vm != null) {
    ConsoleProxyInfo proxy=getConsoleProxyForUserVm(vm.getDataCenterIdToDeployIn(),vmId);
    if (proxy != null) {
      return proxy.getProxyImageUrl();
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public String getConsoleAccessUrlRoot(long vmId){
  VMInstanceVO vm=_vmInstanceDao.findById(vmId);
  if (vm != null) {
    ConsoleProxyInfo proxy=getConsoleProxyForVm(vm.getDataCenterIdToDeployIn(),vmId);
    if (proxy != null) {
      return proxy.getProxyImageUrl();
    }
  }
  return null;
}
Program: 106628
Project: 106628
Buggy source:
private void createDhcpEntriesCommands(DomainRouterVO router,Commands cmds){
  long networkId=router.getNetworkId();
  List<UserVmVO> vms=_userVmDao.listByNetworkIdAndStates(networkId,State.Running,State.Migrating,State.Stopping);
  DataCenterVO dc=_dcDao.findById(router.getDataCenterIdToDeployIn());
  for (  UserVmVO vm : vms) {
    boolean createDhcp=true;
    if (dc.getNetworkType() == NetworkType.Basic && router.getPodIdToDeployIn().longValue() != vm.getPodIdToDeployIn().longValue() && _dnsBasicZoneUpdates.equalsIgnoreCase("String_Node_Str")) {
      createDhcp=false;
    }
    if (createDhcp) {
      NicVO nic=_nicDao.findByInstanceIdAndNetworkId(networkId,vm.getId());
      if (nic != null) {
        s_logger.debug("String_Node_Str" + vm + "String_Node_Str"+ router+ "String_Node_Str");
        DhcpEntryCommand dhcpCommand=new DhcpEntryCommand(nic.getMacAddress(),nic.getIp4Address(),vm.getHostName());
        dhcpCommand.setDefaultRouter(_nicDao.findDefaultNicForVM(vm.getId()).getGateway());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP,router.getPrivateIpAddress());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME,router.getInstanceName());
        DataCenterVO dcVo=_dcDao.findById(router.getDataCenterIdToDeployIn());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE,dcVo.getNetworkType().toString());
        cmds.addCommand("String_Node_Str",dhcpCommand);
      }
    }
  }
}

Fixed version (ground truth):
private void createDhcpEntriesCommands(DomainRouterVO router,Commands cmds){
  long networkId=router.getNetworkId();
  List<UserVmVO> vms=_userVmDao.listByNetworkIdAndStates(networkId,State.Running,State.Migrating,State.Stopping);
  DataCenterVO dc=_dcDao.findById(router.getDataCenterIdToDeployIn());
  for (  UserVmVO vm : vms) {
    boolean createDhcp=true;
    if (dc.getNetworkType() == NetworkType.Basic && router.getPodIdToDeployIn().longValue() != vm.getPodIdToDeployIn().longValue() && _dnsBasicZoneUpdates.equalsIgnoreCase("String_Node_Str")) {
      createDhcp=false;
    }
    if (createDhcp) {
      NicVO nic=_nicDao.findByInstanceIdAndNetworkId(networkId,vm.getId());
      if (nic != null) {
        s_logger.debug("String_Node_Str" + vm + "String_Node_Str"+ router+ "String_Node_Str");
        DhcpEntryCommand dhcpCommand=new DhcpEntryCommand(nic.getMacAddress(),nic.getIp4Address(),vm.getHostName());
        dhcpCommand.setDefaultRouter(findDefaultDhcpIp(vm.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP,router.getPrivateIpAddress());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME,router.getInstanceName());
        DataCenterVO dcVo=_dcDao.findById(router.getDataCenterIdToDeployIn());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE,dcVo.getNetworkType().toString());
        cmds.addCommand("String_Node_Str",dhcpCommand);
      }
    }
  }
}
Program: 106629
Project: 106629
Buggy source:
@Override public void create() throws ResourceAllocationException {
  try {
    IpAddress ip=_networkService.allocateIP(this);
    if (ip != null) {
      this.setEntityId(ip.getId());
    }
 else {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  ConcurrentOperationException ex) {
    s_logger.warn("String_Node_Str",ex);
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,ex.getMessage());
  }
catch (  InsufficientAddressCapacityException ex) {
    s_logger.info(ex);
    s_logger.trace(ex);
    throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR,ex.getMessage());
  }
}

Fixed version (ground truth):
@Override public void create() throws ResourceAllocationException {
  try {
    IpAddress ip=_networkService.allocateIP(getNetworkId(),_accountService.getAccount(getEntityOwnerId()));
    if (ip != null) {
      this.setEntityId(ip.getId());
    }
 else {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str");
    }
  }
 catch (  ConcurrentOperationException ex) {
    s_logger.warn("String_Node_Str",ex);
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,ex.getMessage());
  }
catch (  InsufficientAddressCapacityException ex) {
    s_logger.info(ex);
    s_logger.trace(ex);
    throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR,ex.getMessage());
  }
}
Program: 106630
Project: 106630
Buggy source:
IpAddress allocateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException ;

Fixed version (ground truth):
IpAddress allocateIP(long networkId,Account ipOwner) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException ;
Program: 106632
Project: 106632
Buggy source:
@Override public IpAddress allocateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
  return null;
}

Fixed version (ground truth):
@Override public IpAddress allocateIP(long networkId,Account ipOwner) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
  return null;
}
Program: 106633
Project: 106633
Buggy source:
public Long getSourceIpAddressId(){
  return publicIpId;
}

Fixed version (ground truth):
public Long getSourceIpAddressId(){
  IpAddress ipAddr=_networkService.getIp(publicIpId);
  if (ipAddr == null || !ipAddr.readyToUse()) {
    throw new InvalidParameterValueException("String_Node_Str" + ipAddr.getId());
  }
  return publicIpId;
}
Program: 106634
Project: 106634
Buggy source:
public long getDomainId(){
  if (publicIpId != null)   return _networkService.getIp(getPublicIpId()).getDomainId();
  if (domainId != null) {
    return domainId;
  }
  return UserContext.current().getCaller().getDomainId();
}

Fixed version (ground truth):
public long getDomainId(){
  if (publicIpId != null)   return _networkService.getIp(getSourceIpAddressId()).getDomainId();
  if (domainId != null) {
    return domainId;
  }
  return UserContext.current().getCaller().getDomainId();
}
Program: 106635
Project: 106635
Buggy source:
public long getAccountId(){
  if (publicIpId != null)   return _networkService.getIp(getPublicIpId()).getAccountId();
  Account account=UserContext.current().getCaller();
  if ((account == null)) {
    if ((domainId != null) && (accountName != null)) {
      Account userAccount=_responseGenerator.findAccountByNameDomain(accountName,domainId);
      if (userAccount != null) {
        return userAccount.getId();
      }
    }
  }
  if (account != null) {
    return account.getId();
  }
  return Account.ACCOUNT_ID_SYSTEM;
}

Fixed version (ground truth):
public long getAccountId(){
  if (publicIpId != null)   return _networkService.getIp(getSourceIpAddressId()).getAccountId();
  Account account=UserContext.current().getCaller();
  if ((account == null)) {
    if ((domainId != null) && (accountName != null)) {
      Account userAccount=_responseGenerator.findAccountByNameDomain(accountName,domainId);
      if (userAccount != null) {
        return userAccount.getId();
      }
    }
  }
  if (account != null) {
    return account.getId();
  }
  return Account.ACCOUNT_ID_SYSTEM;
}
Program: 106636
Project: 106636
Buggy source:
@DB public PublicIp allocIp(CreateLoadBalancerRuleCmd lb,Account account) throws InsufficientAddressCapacityException {
  List<NetworkVO> networks=_networkDao.listByZoneAndTrafficType(lb.getZoneId(),TrafficType.Guest);
  if (networks.isEmpty()) {
    s_logger.warn("String_Node_Str" + TrafficType.Guest + "String_Node_Str"+ lb.getZoneId());
    return null;
  }
  Network frontEndNetwork=networks.get(0);
  Transaction txn=Transaction.currentTxn();
  txn.start();
  PublicIp ip=_networkMgr.assignPublicIpAddress(lb.getZoneId(),null,account,VlanType.DirectAttached,frontEndNetwork.getId(),null);
  IPAddressVO ipvo=_ipAddressDao.findById(ip.getId());
  ipvo.setAssociatedWithNetworkId(frontEndNetwork.getId());
  _ipAddressDao.update(ipvo.getId(),ipvo);
  txn.commit();
  s_logger.info("String_Node_Str" + ip);
  return ip;
}

Fixed version (ground truth):
@DB public PublicIp allocIp(CreateLoadBalancerRuleCmd lb,Account account) throws InsufficientAddressCapacityException {
  if (lb.getZoneId() == null) {
    throw new InvalidParameterValueException("String_Node_Str" + Network.Provider.ElasticLoadBalancerVm.getName());
  }
  List<NetworkVO> networks=_networkDao.listByZoneAndTrafficType(lb.getZoneId(),TrafficType.Guest);
  if (networks.isEmpty()) {
    s_logger.warn("String_Node_Str" + TrafficType.Guest + "String_Node_Str"+ lb.getZoneId());
    return null;
  }
  Network frontEndNetwork=networks.get(0);
  Transaction txn=Transaction.currentTxn();
  txn.start();
  PublicIp ip=_networkMgr.assignPublicIpAddress(lb.getZoneId(),null,account,VlanType.DirectAttached,frontEndNetwork.getId(),null);
  IPAddressVO ipvo=_ipAddressDao.findById(ip.getId());
  ipvo.setAssociatedWithNetworkId(frontEndNetwork.getId());
  _ipAddressDao.update(ipvo.getId(),ipvo);
  txn.commit();
  s_logger.info("String_Node_Str" + ip);
  return ip;
}
Program: 106637
Project: 106637
Buggy source:
public boolean listInReadyState(){
  Account account=UserContext.current().getCaller();
  boolean isAccountSpecific=(account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
  TemplateFilter templateFilter=TemplateFilter.valueOf(getIsoFilter());
  boolean onlyReady=(templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable)|| (templateFilter == TemplateFilter.executable && isAccountSpecific)|| (templateFilter == TemplateFilter.community);
  return onlyReady;
}

Fixed version (ground truth):
public boolean listInReadyState(){
  Account account=UserContext.current().getCaller();
  boolean isAccountSpecific=(account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
  TemplateFilter templateFilter=TemplateFilter.valueOf(getIsoFilter());
  boolean onlyReady=(templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable)|| (templateFilter == TemplateFilter.executable && isAccountSpecific)|| (templateFilter == TemplateFilter.community);
  if (!onlyReady) {
    if (isReady() != null && isReady().booleanValue() != onlyReady) {
      onlyReady=isReady().booleanValue();
    }
  }
  return onlyReady;
}
Program: 106638
Project: 106638
Buggy source:
@Override @DB public long addTemplateToZone(VMTemplateVO tmplt,long zoneId){
  Transaction txn=Transaction.currentTxn();
  txn.start();
  VMTemplateVO tmplt2=findById(tmplt.getId());
  if (tmplt2 == null) {
    persist(tmplt);
    if (tmplt.getDetails() != null) {
      _templateDetailsDao.persist(tmplt.getId(),tmplt.getDetails());
    }
  }
  VMTemplateZoneVO tmpltZoneVO=_templateZoneDao.findByZoneTemplate(zoneId,tmplt.getId());
  if (tmpltZoneVO == null) {
    tmpltZoneVO=new VMTemplateZoneVO(zoneId,tmplt.getId(),new Date());
    _templateZoneDao.persist(tmpltZoneVO);
  }
 else {
    tmpltZoneVO.setRemoved(null);
    tmpltZoneVO.setLastUpdated(new Date());
    _templateZoneDao.update(tmpltZoneVO.getId(),tmpltZoneVO);
  }
  txn.commit();
  return tmplt.getId();
}

Fixed version (ground truth):
@Override @DB public long addTemplateToZone(VMTemplateVO tmplt,long zoneId){
  Transaction txn=Transaction.currentTxn();
  txn.start();
  VMTemplateVO tmplt2=findById(tmplt.getId());
  if (tmplt2 == null) {
    if (persist(tmplt) == null) {
      throw new CloudRuntimeException("String_Node_Str" + tmplt);
    }
    if (tmplt.getDetails() != null) {
      _templateDetailsDao.persist(tmplt.getId(),tmplt.getDetails());
    }
  }
  VMTemplateZoneVO tmpltZoneVO=_templateZoneDao.findByZoneTemplate(zoneId,tmplt.getId());
  if (tmpltZoneVO == null) {
    tmpltZoneVO=new VMTemplateZoneVO(zoneId,tmplt.getId(),new Date());
    _templateZoneDao.persist(tmpltZoneVO);
  }
 else {
    tmpltZoneVO.setRemoved(null);
    tmpltZoneVO.setLastUpdated(new Date());
    _templateZoneDao.update(tmpltZoneVO.getId(),tmpltZoneVO);
  }
  txn.commit();
  return tmplt.getId();
}
Program: 106639
Project: 106639
Buggy source:
@Override public VMTemplateVO create(TemplateProfile profile){
  VMTemplateVO template=persistTemplate(profile);
  _downloadMonitor.downloadTemplateToStorage(template,profile.getZoneId());
  _resourceLimitMgr.incrementResourceCount(profile.getAccountId(),ResourceType.template);
  return template;
}

Fixed version (ground truth):
@Override public VMTemplateVO create(TemplateProfile profile){
  VMTemplateVO template=persistTemplate(profile);
  if (template == null) {
    throw new CloudRuntimeException("String_Node_Str" + profile.getTemplate());
  }
  _downloadMonitor.downloadTemplateToStorage(template,profile.getZoneId());
  _resourceLimitMgr.incrementResourceCount(profile.getAccountId(),ResourceType.template);
  return template;
}
Program: 106640
Project: 106640
Buggy source:
protected VMTemplateVO persistTemplate(TemplateProfile profile){
  Long zoneId=profile.getZoneId();
  VMTemplateVO template=new VMTemplateVO(profile.getTemplateId(),profile.getName(),profile.getFormat(),profile.getIsPublic(),profile.getFeatured(),profile.getIsExtractable(),TemplateType.USER,profile.getUrl(),profile.getRequiresHVM(),profile.getBits(),profile.getAccountId(),profile.getCheckSum(),profile.getDisplayText(),profile.getPasswordEnabled(),profile.getGuestOsId(),profile.getBootable(),profile.getHypervisorType(),profile.getTemplateTag(),profile.getDetails());
  if (zoneId == null || zoneId == -1) {
    List<DataCenterVO> dcs=_dcDao.listAllIncludingRemoved();
    for (    DataCenterVO dc : dcs) {
      _tmpltDao.addTemplateToZone(template,dc.getId());
    }
    template.setCrossZones(true);
  }
 else {
    _tmpltDao.addTemplateToZone(template,zoneId);
  }
  return template;
}

Fixed version (ground truth):
protected VMTemplateVO persistTemplate(TemplateProfile profile){
  Long zoneId=profile.getZoneId();
  VMTemplateVO template=new VMTemplateVO(profile.getTemplateId(),profile.getName(),profile.getFormat(),profile.getIsPublic(),profile.getFeatured(),profile.getIsExtractable(),TemplateType.USER,profile.getUrl(),profile.getRequiresHVM(),profile.getBits(),profile.getAccountId(),profile.getCheckSum(),profile.getDisplayText(),profile.getPasswordEnabled(),profile.getGuestOsId(),profile.getBootable(),profile.getHypervisorType(),profile.getTemplateTag(),profile.getDetails());
  if (zoneId == null || zoneId == -1) {
    List<DataCenterVO> dcs=_dcDao.listAll();
    if (dcs.isEmpty()) {
      throw new CloudRuntimeException("String_Node_Str");
    }
    for (    DataCenterVO dc : dcs) {
      _tmpltDao.addTemplateToZone(template,dc.getId());
    }
    template.setCrossZones(true);
  }
 else {
    _tmpltDao.addTemplateToZone(template,zoneId);
  }
  return _tmpltDao.findById(template.getId());
}
Program: 106642
Project: 106642
Buggy source:
@Override public boolean disableStaticNat(long ipId) throws ResourceUnavailableException {
  boolean success=true;
  UserContext ctx=UserContext.current();
  Account caller=ctx.getCaller();
  IPAddressVO ipAddress=_ipAddressDao.findById(ipId);
  checkIpAndUserVm(ipAddress,null,caller);
  if (!ipAddress.isOneToOneNat()) {
    throw new InvalidParameterValueException("String_Node_Str" + ipId);
  }
  try {
    s_logger.debug("String_Node_Str" + Purpose.Firewall + "String_Node_Str"+ ipId+ "String_Node_Str");
    if (!_firewallMgr.revokeFirewallRulesForIp(ipId,ctx.getCallerUserId(),caller)) {
      s_logger.warn("String_Node_Str" + ipId + "String_Node_Str");
      success=false;
    }
  }
 catch (  ResourceUnavailableException e) {
    s_logger.warn("String_Node_Str" + ipId + "String_Node_Str",e);
    success=false;
  }
  if (!revokeAllPFAndStaticNatRulesForIp(ipId,UserContext.current().getCallerUserId(),caller)) {
    s_logger.warn("String_Node_Str" + ipAddress);
    success=false;
  }
  if (success) {
    ipAddress.setOneToOneNat(false);
    ipAddress.setAssociatedWithVmId(null);
    _ipAddressDao.update(ipAddress.getId(),ipAddress);
    return true;
  }
 else {
    s_logger.warn("String_Node_Str" + ipId);
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean disableStaticNat(long ipId) throws ResourceUnavailableException {
  boolean success=true;
  UserContext ctx=UserContext.current();
  Account caller=ctx.getCaller();
  IPAddressVO ipAddress=_ipAddressDao.findById(ipId);
  checkIpAndUserVm(ipAddress,null,caller);
  if (!ipAddress.isOneToOneNat()) {
    throw new InvalidParameterValueException("String_Node_Str" + ipId);
  }
  try {
    s_logger.debug("String_Node_Str" + Purpose.Firewall + "String_Node_Str"+ ipId);
    if (!_firewallMgr.revokeFirewallRulesForIp(ipId,ctx.getCallerUserId(),caller)) {
      s_logger.warn("String_Node_Str" + ipId + "String_Node_Str");
      success=false;
    }
  }
 catch (  ResourceUnavailableException e) {
    s_logger.warn("String_Node_Str" + ipId + "String_Node_Str",e);
    success=false;
  }
  if (!revokeAllPFAndStaticNatRulesForIp(ipId,UserContext.current().getCallerUserId(),caller)) {
    s_logger.warn("String_Node_Str" + ipAddress);
    success=false;
  }
  if (success) {
    ipAddress.setOneToOneNat(false);
    ipAddress.setAssociatedWithVmId(null);
    _ipAddressDao.update(ipAddress.getId(),ipAddress);
    return true;
  }
 else {
    s_logger.warn("String_Node_Str" + ipId);
    return false;
  }
}
Program: 106643
Project: 106643
Buggy source:
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_NET_IP_RELEASE,eventDescription="String_Node_Str",async=true) public boolean disassociateIpAddress(long ipAddressId){
  Long userId=UserContext.current().getCallerUserId();
  Account caller=UserContext.current().getCaller();
  IPAddressVO ipVO=_ipAddressDao.findById(ipAddressId);
  if (ipVO == null) {
    throw new InvalidParameterValueException("String_Node_Str" + ipAddressId);
  }
  if (ipVO.getAllocatedTime() == null) {
    s_logger.debug("String_Node_Str" + ipAddressId + "String_Node_Str");
    return true;
  }
  if (ipVO.getAllocatedToAccountId() != null) {
    _accountMgr.checkAccess(caller,null,ipVO);
  }
  Network associatedNetwork=getNetwork(ipVO.getAssociatedWithNetworkId());
  if (areServicesSupportedInNetwork(associatedNetwork.getId(),Service.SourceNat)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  VlanVO vlan=_vlanDao.findById(ipVO.getVlanId());
  if (!vlan.getVlanType().equals(VlanType.VirtualNetwork)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (_accountVlanMapDao.findAccountVlanMap(ipVO.getAccountId(),ipVO.getVlanId()) != null) {
    throw new InvalidParameterValueException("String_Node_Str" + ipAddressId + "String_Node_Str");
  }
  return releasePublicIpAddress(ipAddressId,userId,caller);
}

Fixed version (ground truth):
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_NET_IP_RELEASE,eventDescription="String_Node_Str",async=true) public boolean disassociateIpAddress(long ipAddressId){
  Long userId=UserContext.current().getCallerUserId();
  Account caller=UserContext.current().getCaller();
  IPAddressVO ipVO=_ipAddressDao.findById(ipAddressId);
  if (ipVO == null) {
    throw new InvalidParameterValueException("String_Node_Str" + ipAddressId);
  }
  if (ipVO.getAllocatedTime() == null) {
    s_logger.debug("String_Node_Str" + ipAddressId + "String_Node_Str");
    return true;
  }
  if (ipVO.getAllocatedToAccountId() != null) {
    _accountMgr.checkAccess(caller,null,ipVO);
  }
  Network associatedNetwork=getNetwork(ipVO.getAssociatedWithNetworkId());
  if (ipVO.isSourceNat() && areServicesSupportedInNetwork(associatedNetwork.getId(),Service.SourceNat)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  VlanVO vlan=_vlanDao.findById(ipVO.getVlanId());
  if (!vlan.getVlanType().equals(VlanType.VirtualNetwork)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (_accountVlanMapDao.findAccountVlanMap(ipVO.getAccountId(),ipVO.getVlanId()) != null) {
    throw new InvalidParameterValueException("String_Node_Str" + ipAddressId + "String_Node_Str");
  }
  return releasePublicIpAddress(ipAddressId,userId,caller);
}
Program: 106645
Project: 106645
Buggy source:
public RebootAnswer(RebootCommand cmd,String details){
  super(cmd,false,details);
  bytesSent=null;
  bytesReceived=null;
}

Fixed version (ground truth):
public RebootAnswer(RebootCommand cmd,Exception e){
  super(cmd,e);
}
Program: 106646
Project: 106646
Buggy source:
public Integer getVncPort(){
  return vncPort;
}

Fixed version (ground truth):
@Override public Integer getVncPort(){
  return vncPort;
}
Program: 106647
Project: 106647
Buggy source:
public StopAnswer(StopCommand cmd,String details){
  super(cmd,details);
  vncPort=null;
}

Fixed version (ground truth):
public StopAnswer(StopCommand cmd,Exception e){
  super(cmd,e);
}
Program: 106648
Project: 106648
Buggy source:
@Override public ExternalFirewallDeviceVO addSrxFirewall(AddSrxFirewallCmd cmd){
  String deviceName=cmd.getDeviceType();
  if (deviceName.equalsIgnoreCase(NetworkDevice.JuniperSRXFirewall.getName())) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  return addExternalFirewall(cmd.getPhysicalNetworkId(),cmd.getUrl(),cmd.getUsername(),cmd.getPassword(),deviceName,(ServerResource)new JuniperSrxResource());
}

Fixed version (ground truth):
@Override public ExternalFirewallDeviceVO addSrxFirewall(AddSrxFirewallCmd cmd){
  String deviceName=cmd.getDeviceType();
  if (!deviceName.equalsIgnoreCase(NetworkDevice.JuniperSRXFirewall.getName())) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  return addExternalFirewall(cmd.getPhysicalNetworkId(),cmd.getUrl(),cmd.getUsername(),cmd.getPassword(),deviceName,(ServerResource)new JuniperSrxResource());
}
Program: 106649
Project: 106649
Buggy source:
@Override public ExternalLoadBalancerDeviceVO getExternalLoadBalancerForNetwork(Network network){
  NetworkExternalLoadBalancerVO lbDeviceForNetwork=_networkExternalLBDao.findByNetworkId(network.getId());
  if (lbDeviceForNetwork != null) {
    long lbDeviceId=lbDeviceForNetwork.getExternalLBDeviceId();
    ExternalLoadBalancerDeviceVO lbDeviceVo=_externalLoadBalancerDeviceDao.findById(lbDeviceId);
    assert(lbDeviceVo != null);
  }
  return null;
}

Fixed version (ground truth):
@Override public ExternalLoadBalancerDeviceVO getExternalLoadBalancerForNetwork(Network network){
  NetworkExternalLoadBalancerVO lbDeviceForNetwork=_networkExternalLBDao.findByNetworkId(network.getId());
  if (lbDeviceForNetwork != null) {
    long lbDeviceId=lbDeviceForNetwork.getExternalLBDeviceId();
    ExternalLoadBalancerDeviceVO lbDeviceVo=_externalLoadBalancerDeviceDao.findById(lbDeviceId);
    assert(lbDeviceVo != null);
    return lbDeviceVo;
  }
  return null;
}
Program: 106650
Project: 106650
Buggy source:
private boolean canHandle(Network config){
  DataCenter zone=_configMgr.getZone(config.getDataCenterId());
  if ((zone.getNetworkType() == NetworkType.Advanced && config.getGuestType() != Network.GuestType.Isolated) || (zone.getNetworkType() == NetworkType.Basic && config.getGuestType() != Network.GuestType.Shared)) {
    s_logger.trace("String_Node_Str" + config.getGuestType());
    return false;
  }
  return _networkManager.networkIsConfiguredForExternalNetworking(zone.getId(),config.getId());
}

Fixed version (ground truth):
private boolean canHandle(Network config){
  DataCenter zone=_configMgr.getZone(config.getDataCenterId());
  if ((zone.getNetworkType() == NetworkType.Advanced && config.getGuestType() != Network.GuestType.Isolated) || (zone.getNetworkType() == NetworkType.Basic && config.getGuestType() != Network.GuestType.Shared)) {
    s_logger.trace("String_Node_Str" + config.getGuestType());
    return false;
  }
  return _networkManager.networkIsConfiguredForExternalNetworking(zone.getId(),config.getId()) && _ntwkSrvcDao.isProviderSupportedInNetwork(config.getId(),Service.Lb,Network.Provider.JuniperSRX);
}
Program: 106652
Project: 106652
Buggy source:
private List<NetworkVO> listDomainLevelNetworks(SearchCriteria<NetworkVO> sc,Filter searchFilter,long domainId){
  List<Long> networkIds=new ArrayList<Long>();
  Set<Long> allowedDomains=_domainMgr.getDomainParentIds(domainId);
  List<NetworkDomainVO> maps=_networkDomainDao.listDomainNetworkMapByDomain(allowedDomains.toArray());
  for (  NetworkDomainVO map : maps) {
    boolean subdomainAccess=(map.isSubdomainAccess() != null) ? map.isSubdomainAccess() : getAllowSubdomainAccessGlobal();
    if (map.getDomainId() == domainId || subdomainAccess) {
      networkIds.add(map.getNetworkId());
    }
  }
  SearchCriteria<NetworkVO> domainSC=_networksDao.createSearchCriteria();
  domainSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,networkIds.toArray());
  domainSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,ACLType.Domain.toString());
  sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,domainSC);
  return _networksDao.search(sc,searchFilter);
}

Fixed version (ground truth):
private List<NetworkVO> listDomainLevelNetworks(SearchCriteria<NetworkVO> sc,Filter searchFilter,long domainId){
  List<Long> networkIds=new ArrayList<Long>();
  Set<Long> allowedDomains=_domainMgr.getDomainParentIds(domainId);
  List<NetworkDomainVO> maps=_networkDomainDao.listDomainNetworkMapByDomain(allowedDomains.toArray());
  for (  NetworkDomainVO map : maps) {
    boolean subdomainAccess=(map.isSubdomainAccess() != null) ? map.isSubdomainAccess() : getAllowSubdomainAccessGlobal();
    if (map.getDomainId() == domainId || subdomainAccess) {
      networkIds.add(map.getNetworkId());
    }
  }
  if (!networkIds.isEmpty()) {
    SearchCriteria<NetworkVO> domainSC=_networksDao.createSearchCriteria();
    domainSC.addAnd("String_Node_Str",SearchCriteria.Op.IN,networkIds.toArray());
    domainSC.addAnd("String_Node_Str",SearchCriteria.Op.EQ,ACLType.Domain.toString());
    sc.addAnd("String_Node_Str",SearchCriteria.Op.SC,domainSC);
    return _networksDao.search(sc,searchFilter);
  }
 else {
    return new ArrayList<NetworkVO>();
  }
}
Program: 106653
Project: 106653
Buggy source:
public static String getDefaultHostIp(){
  NetworkInterface nic=null;
  String pubNic=getDefaultEthDevice();
  if (pubNic == null) {
    return null;
  }
  try {
    nic=NetworkInterface.getByName(pubNic);
  }
 catch (  final SocketException e) {
    return null;
  }
  String[] info=NetUtils.getNetworkParams(nic);
  return info[0];
}

Fixed version (ground truth):
public static String getDefaultHostIp(){
  if (isWindows()) {
    Pattern pattern=Pattern.compile("String_Node_Str");
    try {
      Process result=Runtime.getRuntime().exec("String_Node_Str");
      BufferedReader output=new BufferedReader(new InputStreamReader(result.getInputStream()));
      String line=output.readLine();
      while (line != null) {
        Matcher matcher=pattern.matcher(line);
        if (matcher.find()) {
          return matcher.group(2);
        }
        line=output.readLine();
      }
    }
 catch (    Exception e) {
    }
    return null;
  }
 else {
    NetworkInterface nic=null;
    String pubNic=getDefaultEthDevice();
    if (pubNic == null) {
      return null;
    }
    try {
      nic=NetworkInterface.getByName(pubNic);
    }
 catch (    final SocketException e) {
      return null;
    }
    String[] info=NetUtils.getNetworkParams(nic);
    return info[0];
  }
}
Program: 106656
Project: 106656
Buggy source:
@Override @ActionEvent(eventType=EventTypes.EVENT_PHYSICAL_NETWORK_DELETE,eventDescription="String_Node_Str",async=true) public boolean deletePhysicalNetwork(Long physicalNetworkId){
  PhysicalNetworkVO pNetwork=_physicalNetworkDao.findById(physicalNetworkId);
  if (pNetwork == null) {
    throw new InvalidParameterValueException("String_Node_Str" + physicalNetworkId + "String_Node_Str");
  }
  checkIfPhysicalNetworkIsDeletable(physicalNetworkId);
  List<VlanVO> vlans=_vlanDao.listVlansByPhysicalNetworkId(physicalNetworkId);
  for (  VlanVO vlan : vlans) {
    _vlanDao.remove(vlan.getId());
  }
  List<NetworkVO> networks=_networksDao.listByPhysicalNetworkIncludingRemoved(physicalNetworkId);
  if (networks != null && !networks.isEmpty()) {
    for (    NetworkVO network : networks) {
      _networksDao.remove(network.getId());
    }
  }
  _dcDao.deleteVnet(physicalNetworkId);
  _pNSPDao.deleteProviders(physicalNetworkId);
  boolean success=_physicalNetworkDao.remove(physicalNetworkId);
  return success;
}

Fixed version (ground truth):
@Override @ActionEvent(eventType=EventTypes.EVENT_PHYSICAL_NETWORK_DELETE,eventDescription="String_Node_Str",async=true) public boolean deletePhysicalNetwork(Long physicalNetworkId){
  PhysicalNetworkVO pNetwork=_physicalNetworkDao.findById(physicalNetworkId);
  if (pNetwork == null) {
    throw new InvalidParameterValueException("String_Node_Str" + physicalNetworkId + "String_Node_Str");
  }
  checkIfPhysicalNetworkIsDeletable(physicalNetworkId);
  List<VlanVO> vlans=_vlanDao.listVlansByPhysicalNetworkId(physicalNetworkId);
  for (  VlanVO vlan : vlans) {
    _vlanDao.remove(vlan.getId());
  }
  List<NetworkVO> networks=_networksDao.listByPhysicalNetwork(physicalNetworkId);
  if (networks != null && !networks.isEmpty()) {
    for (    NetworkVO network : networks) {
      _networksDao.remove(network.getId());
    }
  }
  _dcDao.deleteVnet(physicalNetworkId);
  _pNSPDao.deleteProviders(physicalNetworkId);
  boolean success=_physicalNetworkDao.remove(physicalNetworkId);
  return success;
}
Program: 106660
Project: 106660
Buggy source:
@DB public Long getIdentityId(String tableName,String identityString){
  assert(tableName != null);
  assert(identityString != null);
  PreparedStatement pstmt=null;
  Transaction txn=Transaction.open(Transaction.CLOUD_DB);
  try {
    try {
      pstmt=txn.prepareAutoCloseStatement(String.format("String_Node_Str",tableName));
      long id=0;
      try {
        id=Long.parseLong(identityString);
      }
 catch (      NumberFormatException e) {
      }
      pstmt.setLong(1,id);
      pstmt.setString(2,identityString);
      ResultSet rs=pstmt.executeQuery();
      if (rs.next()) {
        return rs.getLong(1);
      }
 else {
        throw new InvalidParameterValueException("String_Node_Str" + tableName + "String_Node_Str"+ identityString+ "String_Node_Str");
      }
    }
 catch (    SQLException e) {
      s_logger.error("String_Node_Str",e);
    }
  }
  finally {
    txn.close();
  }
  return null;
}

Fixed version (ground truth):
@DB public Long getIdentityId(String tableName,String identityString){
  assert(tableName != null);
  assert(identityString != null);
  PreparedStatement pstmt=null;
  Transaction txn=Transaction.open(Transaction.CLOUD_DB);
  try {
    try {
      pstmt=txn.prepareAutoCloseStatement(String.format("String_Node_Str",tableName));
      long id=0;
      try {
        id=Long.parseLong(identityString);
      }
 catch (      NumberFormatException e) {
      }
      pstmt.setLong(1,id);
      pstmt.setString(2,identityString);
      ResultSet rs=pstmt.executeQuery();
      if (rs.next()) {
        return rs.getLong(1);
      }
 else {
        if (id != 0)         return id;
        throw new InvalidParameterValueException("String_Node_Str" + tableName + "String_Node_Str"+ identityString+ "String_Node_Str");
      }
    }
 catch (    SQLException e) {
      s_logger.error("String_Node_Str",e);
    }
  }
  finally {
    txn.close();
  }
  return null;
}
Program: 106661
Project: 106661
Buggy source:
public String getResponse(long jobId,long objectId){
  CreateCmdResponse response=new CreateCmdResponse();
  response.setJobId(jobId);
  response.setId(objectId);
  response.setResponseName(getCommandName());
  return _responseGenerator.toSerializedString(response,getResponseType());
}

Fixed version (ground truth):
public String getResponse(long jobId,long objectId,String objectEntityTable){
  CreateCmdResponse response=new CreateCmdResponse();
  response.setJobId(jobId);
  response.setId(objectId);
  response.setIdEntityTable(objectEntityTable);
  response.setResponseName(getCommandName());
  return _responseGenerator.toSerializedString(response,getResponseType());
}
Program: 106662
Project: 106662
Buggy source:
public Long getId(){
  return id.getValue();
}

Fixed version (ground truth):
public Long getId(){
  return getJobId();
}
Program: 106663
Project: 106663
Buggy source:
public void setJobInstanceType(String jobInstanceType){
  this.jobInstanceType=jobInstanceType;
  if (jobInstanceType != null) {
    if (jobInstanceType.equalsIgnoreCase("String_Node_Str")) {
      this.jobInstanceIdProxy.setTableName("String_Node_Str");
    }
 else     if (jobInstanceType.equalsIgnoreCase("String_Node_Str")) {
      this.jobInstanceIdProxy.setTableName("String_Node_Str");
    }
 else     if (jobInstanceType.equalsIgnoreCase("String_Node_Str")) {
      this.jobInstanceIdProxy.setTableName("String_Node_Str");
    }
 else {
      assert(false);
    }
  }
}

Fixed version (ground truth):
public void setJobInstanceType(String jobInstanceType){
  this.jobInstanceType=jobInstanceType;
  if (jobInstanceType != null) {
    if (jobInstanceType.equalsIgnoreCase("String_Node_Str")) {
      this.jobInstanceId.setTableName("String_Node_Str");
    }
 else     if (jobInstanceType.equalsIgnoreCase("String_Node_Str")) {
      this.jobInstanceId.setTableName("String_Node_Str");
    }
 else     if (jobInstanceType.equalsIgnoreCase("String_Node_Str")) {
      this.jobInstanceId.setTableName("String_Node_Str");
    }
 else {
      assert(false);
    }
  }
}
Program: 106664
Project: 106664
Buggy source:
public void setJobInstanceId(Long jobInstanceId){
  this.jobInstanceIdProxy.setValue(jobInstanceId);
}

Fixed version (ground truth):
public void setJobInstanceId(Long jobInstanceId){
  this.jobInstanceId.setValue(jobInstanceId);
}
Program: 106665
Project: 106665
Buggy source:
public void setId(Long id){
  this.id.setValue(id);
}

Fixed version (ground truth):
public void setId(Long id){
  setJobId(id);
}
Program: 106666
Project: 106666
Buggy source:
public Long getJobInstanceId(){
  return jobInstanceIdProxy.getValue();
}

Fixed version (ground truth):
public Long getJobInstanceId(){
  return this.jobInstanceId.getValue();
}
Program: 106667
Project: 106667
Buggy source:
public void setJobId(Long jobId){
  this.jobId=jobId;
}

Fixed version (ground truth):
public void setJobId(Long jobId){
  this.jobId.setValue(jobId);
}