nus-yam/ex-repair huggingface dataset:
Program: 106552
Project: 106552
Buggy source:
@Override public List<? extends SSHKeyPair> listSSHKeyPairs(ListSSHKeyPairsCmd cmd){
  String name=cmd.getName();
  String fingerPrint=cmd.getFingerprint();
  Account caller=UserContext.current().getCaller();
  List<Long> permittedAccounts=new ArrayList<Long>();
  Ternary<Long,Boolean,ListProjectResourcesCriteria> domainIdRecursiveListProject=new Ternary<Long,Boolean,ListProjectResourcesCriteria>(cmd.getDomainId(),cmd.isRecursive(),null);
  _accountMgr.buildACLSearchParameters(caller,null,cmd.getAccountName(),cmd.getProjectId(),permittedAccounts,domainIdRecursiveListProject,cmd.listAll());
  Long domainId=domainIdRecursiveListProject.first();
  Boolean isRecursive=domainIdRecursiveListProject.second();
  ListProjectResourcesCriteria listProjectResourcesCriteria=domainIdRecursiveListProject.third();
  SearchBuilder<SSHKeyPairVO> sb=_sshKeyPairDao.createSearchBuilder();
  _accountMgr.buildACLSearchBuilder(sb,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  Filter searchFilter=new Filter(SSHKeyPairVO.class,"String_Node_Str",false,cmd.getStartIndex(),cmd.getPageSizeVal());
  SearchCriteria<SSHKeyPairVO> sc=sb.create();
  _accountMgr.buildACLSearchCriteria(sc,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  if (name != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,name);
  }
  if (fingerPrint != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,fingerPrint);
  }
  return _sshKeyPairDao.search(sc,searchFilter);
}

Fixed version (ground truth):
@Override public List<? extends SSHKeyPair> listSSHKeyPairs(ListSSHKeyPairsCmd cmd){
  String name=cmd.getName();
  String fingerPrint=cmd.getFingerprint();
  Account caller=UserContext.current().getCaller();
  List<Long> permittedAccounts=new ArrayList<Long>();
  Ternary<Long,Boolean,ListProjectResourcesCriteria> domainIdRecursiveListProject=new Ternary<Long,Boolean,ListProjectResourcesCriteria>(cmd.getDomainId(),cmd.isRecursive(),null);
  _accountMgr.buildACLSearchParameters(caller,null,cmd.getAccountName(),cmd.getProjectId(),permittedAccounts,domainIdRecursiveListProject,cmd.listAll(),false);
  Long domainId=domainIdRecursiveListProject.first();
  Boolean isRecursive=domainIdRecursiveListProject.second();
  ListProjectResourcesCriteria listProjectResourcesCriteria=domainIdRecursiveListProject.third();
  SearchBuilder<SSHKeyPairVO> sb=_sshKeyPairDao.createSearchBuilder();
  _accountMgr.buildACLSearchBuilder(sb,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  Filter searchFilter=new Filter(SSHKeyPairVO.class,"String_Node_Str",false,cmd.getStartIndex(),cmd.getPageSizeVal());
  SearchCriteria<SSHKeyPairVO> sc=sb.create();
  _accountMgr.buildACLSearchCriteria(sc,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  if (name != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,name);
  }
  if (fingerPrint != null) {
    sc.addAnd("String_Node_Str",SearchCriteria.Op.EQ,fingerPrint);
  }
  return _sshKeyPairDao.search(sc,searchFilter);
}
Program: 106558
Project: 106558
Buggy source:
@Override public Set<Pair<Long,Long>> listIsos(ListIsosCmd cmd) throws IllegalArgumentException, InvalidParameterValueException {
  TemplateFilter isoFilter=TemplateFilter.valueOf(cmd.getIsoFilter());
  Account caller=UserContext.current().getCaller();
  boolean listAll=(caller.getType() != Account.ACCOUNT_TYPE_NORMAL && (isoFilter != null && isoFilter == TemplateFilter.all));
  List<Long> permittedAccountIds=new ArrayList<Long>();
  Ternary<Long,Boolean,ListProjectResourcesCriteria> domainIdRecursiveListProject=new Ternary<Long,Boolean,ListProjectResourcesCriteria>(cmd.getDomainId(),cmd.isRecursive(),null);
  _accountMgr.buildACLSearchParameters(caller,cmd.getId(),cmd.getAccountName(),cmd.getProjectId(),permittedAccountIds,domainIdRecursiveListProject,listAll);
  ListProjectResourcesCriteria listProjectResourcesCriteria=domainIdRecursiveListProject.third();
  List<Account> permittedAccounts=new ArrayList<Account>();
  for (  Long accountId : permittedAccountIds) {
    permittedAccounts.add(_accountMgr.getAccount(accountId));
  }
  HypervisorType hypervisorType=HypervisorType.getType(cmd.getHypervisor());
  return listTemplates(cmd.getId(),cmd.getIsoName(),cmd.getKeyword(),isoFilter,true,cmd.isBootable(),cmd.getPageSizeVal(),cmd.getStartIndex(),cmd.getZoneId(),hypervisorType,true,cmd.listInReadyState(),permittedAccounts,caller,listProjectResourcesCriteria);
}

Fixed version (ground truth):
@Override public Set<Pair<Long,Long>> listIsos(ListIsosCmd cmd) throws IllegalArgumentException, InvalidParameterValueException {
  TemplateFilter isoFilter=TemplateFilter.valueOf(cmd.getIsoFilter());
  Account caller=UserContext.current().getCaller();
  boolean listAll=(caller.getType() != Account.ACCOUNT_TYPE_NORMAL && (isoFilter != null && isoFilter == TemplateFilter.all));
  List<Long> permittedAccountIds=new ArrayList<Long>();
  Ternary<Long,Boolean,ListProjectResourcesCriteria> domainIdRecursiveListProject=new Ternary<Long,Boolean,ListProjectResourcesCriteria>(cmd.getDomainId(),cmd.isRecursive(),null);
  _accountMgr.buildACLSearchParameters(caller,cmd.getId(),cmd.getAccountName(),cmd.getProjectId(),permittedAccountIds,domainIdRecursiveListProject,listAll,false);
  ListProjectResourcesCriteria listProjectResourcesCriteria=domainIdRecursiveListProject.third();
  List<Account> permittedAccounts=new ArrayList<Account>();
  for (  Long accountId : permittedAccountIds) {
    permittedAccounts.add(_accountMgr.getAccount(accountId));
  }
  HypervisorType hypervisorType=HypervisorType.getType(cmd.getHypervisor());
  return listTemplates(cmd.getId(),cmd.getIsoName(),cmd.getKeyword(),isoFilter,true,cmd.isBootable(),cmd.getPageSizeVal(),cmd.getStartIndex(),cmd.getZoneId(),hypervisorType,true,cmd.listInReadyState(),permittedAccounts,caller,listProjectResourcesCriteria);
}
Program: 106561
Project: 106561
Buggy source:
void buildACLSearchParameters(Account caller,Long id,String accountName,Long projectId,List<Long> permittedAccounts,Ternary<Long,Boolean,ListProjectResourcesCriteria> domainIdRecursiveListProject,boolean listAll);

Fixed version (ground truth):
void buildACLSearchParameters(Account caller,Long id,String accountName,Long projectId,List<Long> permittedAccounts,Ternary<Long,Boolean,ListProjectResourcesCriteria> domainIdRecursiveListProject,boolean listAll,boolean forProjectInvitation);
Program: 106565
Project: 106565
Buggy source:
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);
}

Fixed version (ground truth):
protected HashMap<String,Pair<String,State>> fullClusterSync(Connection conn){
synchronized (_cluster.intern()) {
    s_vms.clear(_cluster);
  }
  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);
synchronized (_cluster.intern()) {
          s_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 s_vms.getClusterVmState(_cluster);
}
Program: 106566
Project: 106566
Buggy source:
@Override protected FenceAnswer execute(FenceCommand cmd){
  Connection conn=getConnection();
  try {
    String result=callHostPluginPremium(conn,"String_Node_Str","String_Node_Str",cmd.getHostGuid(),"String_Node_Str",Integer.toString(_heartbeatInterval * 2));
    if (!result.contains("String_Node_Str")) {
      s_logger.debug("String_Node_Str");
      return new FenceAnswer(cmd,false,"String_Node_Str");
    }
    Set<VM> vms=VM.getByNameLabel(conn,cmd.getVmName());
    for (    VM vm : vms) {
      Set<VDI> vdis=new HashSet<VDI>();
      Set<VBD> vbds=vm.getVBDs(conn);
      for (      VBD vbd : vbds) {
        VDI vdi=vbd.getVDI(conn);
        if (!isRefNull(vdi)) {
          vdis.add(vdi);
        }
      }
      vm.powerStateReset(conn);
      vm.destroy(conn);
      for (      VDI vdi : vdis) {
        Map<String,String> smConfig=vdi.getSmConfig(conn);
        for (        String key : smConfig.keySet()) {
          if (key.startsWith("String_Node_Str")) {
            vdi.removeFromSmConfig(conn,key);
            break;
          }
        }
      }
    }
    return new FenceAnswer(cmd);
  }
 catch (  XmlRpcException e) {
    s_logger.warn("String_Node_Str",e);
    return new FenceAnswer(cmd,false,e.getMessage());
  }
catch (  XenAPIException e) {
    s_logger.warn("String_Node_Str",e);
    return new FenceAnswer(cmd,false,e.getMessage());
  }
}

Fixed version (ground truth):
@Override protected FenceAnswer execute(FenceCommand cmd){
  Connection conn=getConnection();
  try {
    String result=callHostPluginPremium(conn,"String_Node_Str","String_Node_Str",cmd.getHostGuid(),"String_Node_Str",Integer.toString(_heartbeatInterval * 2));
    if (!result.contains("String_Node_Str")) {
      s_logger.debug("String_Node_Str");
      return new FenceAnswer(cmd,false,"String_Node_Str");
    }
    Set<VM> vms=VM.getByNameLabel(conn,cmd.getVmName());
    for (    VM vm : vms) {
      Set<VDI> vdis=new HashSet<VDI>();
      Set<VBD> vbds=vm.getVBDs(conn);
      for (      VBD vbd : vbds) {
        VDI vdi=vbd.getVDI(conn);
        if (!isRefNull(vdi)) {
          vdis.add(vdi);
        }
      }
synchronized (_cluster.intern()) {
        s_vms.remove(_cluster,_name,vm.getNameLabel(conn));
      }
      s_logger.info("String_Node_Str" + cmd.getVmName());
      vm.powerStateReset(conn);
      vm.destroy(conn);
      for (      VDI vdi : vdis) {
        Map<String,String> smConfig=vdi.getSmConfig(conn);
        for (        String key : smConfig.keySet()) {
          if (key.startsWith("String_Node_Str")) {
            vdi.removeFromSmConfig(conn,key);
            break;
          }
        }
      }
    }
    return new FenceAnswer(cmd);
  }
 catch (  XmlRpcException e) {
    s_logger.warn("String_Node_Str",e);
    return new FenceAnswer(cmd,false,e.getMessage());
  }
catch (  XenAPIException e) {
    s_logger.warn("String_Node_Str",e);
    return new FenceAnswer(cmd,false,e.getMessage());
  }
}
Program: 106569
Project: 106569
Buggy source:
@Override public void performDataMigration(Connection conn){
  encryptData(conn);
  dropKeysIfExist(conn);
  setupPhysicalNetworks(conn);
}

Fixed version (ground truth):
@Override public void performDataMigration(Connection conn){
  encryptData(conn);
  dropKeysIfExist(conn);
  setupPhysicalNetworks(conn);
  createNetworkOfferingServices(conn);
}
Program: 106570
Project: 106570
Buggy source:
private void encryptData(Connection conn){
  encryptConfigValues(conn);
  encryptHostDetails(conn);
  encryptVNCPassword(conn);
  encryptUserCredentials(conn);
  createNetworkOfferingServices(conn);
}

Fixed version (ground truth):
private void encryptData(Connection conn){
  encryptConfigValues(conn);
  encryptHostDetails(conn);
  encryptVNCPassword(conn);
  encryptUserCredentials(conn);
}
Program: 106571
Project: 106571
Buggy source:
public void test2213to30Upgrade() throws SQLException {
}

Fixed version (ground truth):
public void test2213to30Upgrade() throws SQLException {
  s_logger.debug("String_Node_Str");
  DbTestUtils.executeScript("String_Node_Str",false,true);
  DatabaseUpgradeChecker checker=ComponentLocator.inject(DatabaseUpgradeChecker.class);
  checker.upgrade("String_Node_Str","String_Node_Str");
  Connection conn=Transaction.getStandaloneConnection();
  try {
    checkPhysicalNetworks(conn);
    checkNetworkOfferings(conn);
  }
  finally {
    try {
      conn.close();
    }
 catch (    SQLException e) {
    }
  }
}
Program: 106576
Project: 106576
Buggy source:
private boolean restartNetwork(long networkId,Account callerAccount,User callerUser,boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
  NetworkVO network=_networksDao.findById(networkId);
  s_logger.debug("String_Node_Str" + networkId + "String_Node_Str");
  ReservationContext context=new ReservationContextImpl(null,null,callerUser,callerAccount);
  if (cleanup) {
    s_logger.debug("String_Node_Str" + networkId + "String_Node_Str");
    if (!shutdownNetworkElementsAndResources(context,true,network)) {
      s_logger.debug("String_Node_Str" + network.getState());
      setRestartRequired(network,true);
      return false;
    }
  }
 else {
    s_logger.debug("String_Node_Str" + networkId);
  }
  DeployDestination dest=new DeployDestination(_dcDao.findById(network.getDataCenterId()),null,null,null);
  s_logger.debug("String_Node_Str" + network + "String_Node_Str");
  NetworkOfferingVO offering=_networkOfferingDao.findById(network.getNetworkOfferingId());
  try {
    implementNetworkElementsAndResources(dest,context,network,offering);
    setRestartRequired(network,true);
  }
 catch (  Exception ex) {
    s_logger.warn("String_Node_Str" + network + "String_Node_Str",ex);
    return false;
  }
  setRestartRequired(network,false);
  return true;
}

Fixed version (ground truth):
private boolean restartNetwork(long networkId,Account callerAccount,User callerUser,boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
  NetworkVO network=_networksDao.findById(networkId);
  s_logger.debug("String_Node_Str" + networkId + "String_Node_Str");
  ReservationContext context=new ReservationContextImpl(null,null,callerUser,callerAccount);
  if (cleanup) {
    if (network.getGuestType() != GuestType.Isolated) {
      s_logger.warn("String_Node_Str");
      return false;
    }
    s_logger.debug("String_Node_Str" + networkId + "String_Node_Str");
    if (!shutdownNetworkElementsAndResources(context,true,network)) {
      s_logger.debug("String_Node_Str" + network.getState());
      setRestartRequired(network,true);
      return false;
    }
  }
 else {
    s_logger.debug("String_Node_Str" + networkId);
  }
  DeployDestination dest=new DeployDestination(_dcDao.findById(network.getDataCenterId()),null,null,null);
  s_logger.debug("String_Node_Str" + network + "String_Node_Str");
  NetworkOfferingVO offering=_networkOfferingDao.findById(network.getNetworkOfferingId());
  try {
    implementNetworkElementsAndResources(dest,context,network,offering);
    setRestartRequired(network,true);
  }
 catch (  Exception ex) {
    s_logger.warn("String_Node_Str" + network + "String_Node_Str",ex);
    return false;
  }
  setRestartRequired(network,false);
  return true;
}
Program: 106579
Project: 106579
Buggy source:
public void uploadVmdkFile(String httpMethod,String urlString,String localFileName,long totalBytesUpdated,ActionDelegate progressUpdater) throws Exception {
  HttpURLConnection conn=getRawHTTPConnection(urlString);
  conn.setDoOutput(true);
  conn.setUseCaches(false);
  conn.setChunkedStreamingMode(_CHUNKSIZE);
  conn.setRequestMethod(httpMethod);
  conn.setRequestProperty("String_Node_Str","String_Node_Str");
  conn.setRequestProperty("String_Node_Str","String_Node_Str");
  conn.setRequestProperty("String_Node_Str",Long.toString(new File(localFileName).length()));
  conn.connect();
  BufferedOutputStream bos=null;
  BufferedInputStream is=null;
  try {
    bos=new BufferedOutputStream(conn.getOutputStream());
    is=new BufferedInputStream(new FileInputStream(localFileName));
    int bytesAvailable=is.available();
    int bufferSize=Math.min(bytesAvailable,_CHUNKSIZE);
    byte[] buffer=new byte[bufferSize];
    while (true) {
      int bytesRead=is.read(buffer,0,bufferSize);
      if (bytesRead == -1) {
        break;
      }
      bos.write(buffer,0,bufferSize);
      totalBytesUpdated+=bytesRead;
      bos.flush();
      if (progressUpdater != null)       progressUpdater.action(new Long(totalBytesUpdated));
    }
    bos.flush();
  }
  finally {
    if (is != null)     is.close();
    if (bos != null)     bos.close();
    conn.disconnect();
  }
}

Fixed version (ground truth):
public void uploadVmdkFile(String httpMethod,String urlString,String localFileName,long totalBytesUpdated,ActionDelegate progressUpdater) throws Exception {
  HttpURLConnection conn=getRawHTTPConnection(urlString);
  conn.setDoOutput(true);
  conn.setUseCaches(false);
  conn.setChunkedStreamingMode(_CHUNKSIZE);
  conn.setRequestMethod(httpMethod);
  conn.setRequestProperty("String_Node_Str","String_Node_Str");
  conn.setRequestProperty("String_Node_Str","String_Node_Str");
  conn.setRequestProperty("String_Node_Str",Long.toString(new File(localFileName).length()));
  conn.connect();
  BufferedOutputStream bos=null;
  BufferedInputStream is=null;
  try {
    bos=new BufferedOutputStream(conn.getOutputStream());
    is=new BufferedInputStream(new FileInputStream(localFileName));
    int bufferSize=_CHUNKSIZE;
    byte[] buffer=new byte[bufferSize];
    while (true) {
      int bytesRead=is.read(buffer,0,bufferSize);
      if (bytesRead == -1) {
        break;
      }
      bos.write(buffer,0,bytesRead);
      totalBytesUpdated+=bytesRead;
      bos.flush();
      if (progressUpdater != null)       progressUpdater.action(new Long(totalBytesUpdated));
    }
    bos.flush();
  }
  finally {
    if (is != null)     is.close();
    if (bos != null)     bos.close();
    conn.disconnect();
  }
}
Program: 106582
Project: 106582
Buggy source:
private boolean doMaintain(final long hostId){
  HostVO host=_hostDao.findById(hostId);
  MaintainAnswer answer=(MaintainAnswer)_agentMgr.easySend(hostId,new MaintainCommand());
  if (answer == null || !answer.getResult()) {
    s_logger.warn("String_Node_Str" + hostId);
    return false;
  }
  try {
    resourceStateTransitTo(host,ResourceState.Event.AdminAskMaintenace,_nodeId);
  }
 catch (  NoTransitionException e) {
    String err="String_Node_Str" + host.getId() + "String_Node_Str"+ ResourceState.Maintenance;
    s_logger.debug(err,e);
    throw new CloudRuntimeException(err + e.getMessage());
  }
  _agentMgr.pullAgentToMaintenance(hostId);
  if (host.getType() == Host.Type.Routing) {
    final List<VMInstanceVO> vms=_vmDao.listByHostId(hostId);
    if (vms.size() == 0) {
      return true;
    }
    List<HostVO> hosts=listAllUpAndEnabledHosts(Host.Type.Routing,host.getClusterId(),host.getPodId(),host.getDataCenterId());
    for (    final VMInstanceVO vm : vms) {
      if (hosts == null || hosts.size() <= 1 || !answer.getMigrate()) {
        _haMgr.scheduleStop(vm,hostId,WorkType.ForceStop);
      }
 else {
        _haMgr.scheduleMigration(vm);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean doMaintain(final long hostId){
  HostVO host=_hostDao.findById(hostId);
  MaintainAnswer answer=(MaintainAnswer)_agentMgr.easySend(hostId,new MaintainCommand());
  if (answer == null || !answer.getResult()) {
    s_logger.warn("String_Node_Str" + hostId);
  }
  try {
    resourceStateTransitTo(host,ResourceState.Event.AdminAskMaintenace,_nodeId);
  }
 catch (  NoTransitionException e) {
    String err="String_Node_Str" + host.getId() + "String_Node_Str"+ ResourceState.Maintenance;
    s_logger.debug(err,e);
    throw new CloudRuntimeException(err + e.getMessage());
  }
  _agentMgr.pullAgentToMaintenance(hostId);
  if (host.getType() == Host.Type.Routing) {
    final List<VMInstanceVO> vms=_vmDao.listByHostId(hostId);
    if (vms.size() == 0) {
      return true;
    }
    List<HostVO> hosts=listAllUpAndEnabledHosts(Host.Type.Routing,host.getClusterId(),host.getPodId(),host.getDataCenterId());
    for (    final VMInstanceVO vm : vms) {
      if (hosts == null || hosts.size() <= 1 || !answer.getMigrate()) {
        _haMgr.scheduleStop(vm,hostId,WorkType.ForceStop);
      }
 else {
        _haMgr.scheduleMigration(vm);
      }
    }
  }
  return true;
}
Program: 106583
Project: 106583
Buggy source:
private boolean doCancelMaintenance(long hostId){
  HostVO host;
  host=_hostDao.findById(hostId);
  if (host == null || host.getRemoved() != null) {
    s_logger.warn("String_Node_Str" + hostId);
    return true;
  }
  if (host.getResourceState() != ResourceState.PrepareForMaintenance && host.getResourceState() != ResourceState.Maintenance && host.getResourceState() != ResourceState.ErrorInMaintenance) {
    throw new CloudRuntimeException("String_Node_Str" + host.getResourceState() + "String_Node_Str"+ hostId);
  }
  _haMgr.cancelScheduledMigrations(host);
  List<VMInstanceVO> vms=_haMgr.findTakenMigrationWork();
  for (  VMInstanceVO vm : vms) {
    if (vm.getHostId() != null && vm.getHostId() == hostId) {
      s_logger.info("String_Node_Str" + vm);
      return false;
    }
  }
  try {
    resourceStateTransitTo(host,ResourceState.Event.AdminCancelMaintenance,_nodeId);
    _agentMgr.pullAgentOutMaintenance(hostId);
    return true;
  }
 catch (  NoTransitionException e) {
    s_logger.debug("String_Node_Str" + host.getId() + "String_Node_Str",e);
    return false;
  }
}

Fixed version (ground truth):
private boolean doCancelMaintenance(long hostId){
  HostVO host;
  host=_hostDao.findById(hostId);
  if (host == null || host.getRemoved() != null) {
    s_logger.warn("String_Node_Str" + hostId);
    return true;
  }
  if (host.getResourceState() != ResourceState.PrepareForMaintenance && host.getResourceState() != ResourceState.Maintenance && host.getResourceState() != ResourceState.ErrorInMaintenance) {
    throw new CloudRuntimeException("String_Node_Str" + host.getResourceState() + "String_Node_Str"+ hostId);
  }
  _haMgr.cancelScheduledMigrations(host);
  List<VMInstanceVO> vms=_haMgr.findTakenMigrationWork();
  for (  VMInstanceVO vm : vms) {
    if (vm.getHostId() != null && vm.getHostId() == hostId) {
      s_logger.info("String_Node_Str" + vm);
      return false;
    }
  }
  try {
    resourceStateTransitTo(host,ResourceState.Event.AdminCancelMaintenance,_nodeId);
    _agentMgr.pullAgentOutMaintenance(hostId);
    if (host.getHypervisorType() == HypervisorType.KVM) {
      _hostDao.loadDetails(host);
      String password=host.getDetail("String_Node_Str");
      String username=host.getDetail("String_Node_Str");
      if (password == null || username == null) {
        s_logger.debug("String_Node_Str");
        return false;
      }
      com.trilead.ssh2.Connection connection=SSHCmdHelper.acquireAuthorizedConnection(host.getPrivateIpAddress(),22,username,password);
      if (connection == null) {
        s_logger.debug("String_Node_Str" + host.getPrivateIpAddress());
        return false;
      }
      try {
        SSHCmdHelper.sshExecuteCmdOneShot(connection,"String_Node_Str");
      }
 catch (      sshException e) {
        return false;
      }
    }
    return true;
  }
 catch (  NoTransitionException e) {
    s_logger.debug("String_Node_Str" + host.getId() + "String_Node_Str",e);
    return false;
  }
}
Program: 106586
Project: 106586
Buggy source:
@Override public void checkVirtualNetworkCidrOverlap(Long zoneId,String cidr){
  if (zoneId == null) {
    return;
  }
  List<NetworkVO> networks=_networksDao.listByZone((long)zoneId);
  Map<Long,String> networkToCidr=new HashMap<Long,String>();
  for (  NetworkVO network : networks) {
    if (network.getGuestType() != GuestType.Isolated) {
      continue;
    }
    networkToCidr.put(network.getId(),network.getCidr());
  }
  if (networkToCidr == null || networkToCidr.isEmpty()) {
    return;
  }
  String currCidrAddress=getCidrAddress(cidr);
  int currCidrSize=getCidrSize(cidr);
  for (  long networkId : networkToCidr.keySet()) {
    String ntwkCidr=networkToCidr.get(networkId);
    String ntwkCidrAddress=getCidrAddress(ntwkCidr);
    int ntwkCidrSize=getCidrSize(ntwkCidr);
    long cidrSizeToUse=currCidrSize < ntwkCidrSize ? currCidrSize : ntwkCidrSize;
    String ntwkCidrSubnet=NetUtils.getCidrSubNet(getCidrAddress(ntwkCidr),cidrSizeToUse);
    String cidrSubnet=NetUtils.getCidrSubNet(currCidrAddress,cidrSizeToUse);
    if (cidrSubnet.equals(ntwkCidrSubnet)) {
      throw new InvalidParameterValueException("String_Node_Str" + networkId + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void checkVirtualNetworkCidrOverlap(Long zoneId,String cidr){
  if (zoneId == null) {
    return;
  }
  if (cidr == null) {
    return;
  }
  List<NetworkVO> networks=_networksDao.listByZone((long)zoneId);
  Map<Long,String> networkToCidr=new HashMap<Long,String>();
  for (  NetworkVO network : networks) {
    if (network.getGuestType() != GuestType.Isolated) {
      continue;
    }
    networkToCidr.put(network.getId(),network.getCidr());
  }
  if (networkToCidr == null || networkToCidr.isEmpty()) {
    return;
  }
  String currCidrAddress=getCidrAddress(cidr);
  int currCidrSize=getCidrSize(cidr);
  for (  long networkId : networkToCidr.keySet()) {
    String ntwkCidr=networkToCidr.get(networkId);
    String ntwkCidrAddress=getCidrAddress(ntwkCidr);
    int ntwkCidrSize=getCidrSize(ntwkCidr);
    long cidrSizeToUse=currCidrSize < ntwkCidrSize ? currCidrSize : ntwkCidrSize;
    String ntwkCidrSubnet=NetUtils.getCidrSubNet(getCidrAddress(ntwkCidr),cidrSizeToUse);
    String cidrSubnet=NetUtils.getCidrSubNet(currCidrAddress,cidrSizeToUse);
    if (cidrSubnet.equals(ntwkCidrSubnet)) {
      throw new InvalidParameterValueException("String_Node_Str" + networkId + "String_Node_Str");
    }
  }
}
Program: 106587
Project: 106587
Buggy source:
public Integer getPageSize(){
  if (pageSize != null && MAX_PAGESIZE != null && pageSize.longValue() > MAX_PAGESIZE.longValue()) {
    throw new InvalidParameterValueException("String_Node_Str" + MAX_PAGESIZE.longValue());
  }
  if (pageSize != null && pageSize.longValue() == -1 && page != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  return pageSize;
}

Fixed version (ground truth):
public Integer getPageSize(){
  if (pageSize != null && MAX_PAGESIZE != null && pageSize.longValue() > MAX_PAGESIZE.longValue()) {
    throw new InvalidParameterValueException("String_Node_Str" + MAX_PAGESIZE.longValue());
  }
  if (pageSize != null && pageSize.longValue() == PAGESIZE_UNLIMITED && page != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  return pageSize;
}
Program: 106588
Project: 106588
Buggy source:
static void configure(){
  if (_configService.getDefaultPageSize().longValue() != -1) {
    MAX_PAGESIZE=_configService.getDefaultPageSize();
  }
}

Fixed version (ground truth):
static void configure(){
  if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {
    MAX_PAGESIZE=_configService.getDefaultPageSize();
  }
}
Program: 106589
Project: 106589
Buggy source:
public Long getPageSizeVal(){
  Long defaultPageSize=MAX_PAGESIZE;
  Integer pageSizeInt=getPageSize();
  if (pageSizeInt != null && pageSizeInt.intValue() != -1) {
    defaultPageSize=pageSizeInt.longValue();
  }
  return defaultPageSize;
}

Fixed version (ground truth):
public Long getPageSizeVal(){
  Long defaultPageSize=MAX_PAGESIZE;
  Integer pageSizeInt=getPageSize();
  if (pageSizeInt != null) {
    if (pageSizeInt.longValue() == PAGESIZE_UNLIMITED) {
      defaultPageSize=null;
    }
 else {
      defaultPageSize=pageSizeInt.longValue();
    }
  }
  return defaultPageSize;
}
Program: 106591
Project: 106591
Buggy source:
@Override public String toString(){
  StringBuilder storageVolBuilder=new StringBuilder();
  storageVolBuilder.append("String_Node_Str");
  storageVolBuilder.append("String_Node_Str" + _volName + "String_Node_Str");
  if (_volSize != null) {
    storageVolBuilder.append("String_Node_Str" + _volSize + "String_Node_Str");
  }
  storageVolBuilder.append("String_Node_Str");
  storageVolBuilder.append("String_Node_Str" + _volFormat + "String_Node_Str");
  storageVolBuilder.append("String_Node_Str");
  if (_backingPath != null) {
    storageVolBuilder.append("String_Node_Str");
    storageVolBuilder.append("String_Node_Str" + _backingPath + "String_Node_Str");
    storageVolBuilder.append("String_Node_Str" + _backingFormat + "String_Node_Str");
    storageVolBuilder.append("String_Node_Str");
  }
  storageVolBuilder.append("String_Node_Str");
  return storageVolBuilder.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder storageVolBuilder=new StringBuilder();
  storageVolBuilder.append("String_Node_Str");
  storageVolBuilder.append("String_Node_Str" + _volName + "String_Node_Str");
  if (_volSize != null) {
    storageVolBuilder.append("String_Node_Str" + _volSize + "String_Node_Str");
  }
  storageVolBuilder.append("String_Node_Str");
  storageVolBuilder.append("String_Node_Str" + _volFormat + "String_Node_Str");
  storageVolBuilder.append("String_Node_Str");
  storageVolBuilder.append("String_Node_Str");
  storageVolBuilder.append("String_Node_Str");
  storageVolBuilder.append("String_Node_Str");
  if (_backingPath != null) {
    storageVolBuilder.append("String_Node_Str");
    storageVolBuilder.append("String_Node_Str" + _backingPath + "String_Node_Str");
    storageVolBuilder.append("String_Node_Str" + _backingFormat + "String_Node_Str");
    storageVolBuilder.append("String_Node_Str");
  }
  storageVolBuilder.append("String_Node_Str");
  return storageVolBuilder.toString();
}
Program: 106592
Project: 106592
Buggy source:
@Override public String getProviderForServiceInNetwork(long networkId,Service service){
  SearchCriteria<NetworkServiceMapVO> sc=AllFieldsSearch.create();
  sc.setParameters("String_Node_Str",networkId);
  sc.setParameters("String_Node_Str",service.getName());
  NetworkServiceMapVO ntwkSvc=findOneBy(sc);
  if (ntwkSvc == null) {
    throw new UnsupportedServiceException("String_Node_Str" + service + "String_Node_Str"+ networkId);
  }
  return ntwkSvc.getProvider();
}

Fixed version (ground truth):
@Override public String getProviderForServiceInNetwork(long networkId,Service service){
  SearchCriteria<NetworkServiceMapVO> sc=AllFieldsSearch.create();
  sc.setParameters("String_Node_Str",networkId);
  sc.setParameters("String_Node_Str",service.getName());
  NetworkServiceMapVO ntwkSvc=findOneBy(sc);
  if (ntwkSvc == null) {
    throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ networkId);
  }
  return ntwkSvc.getProvider();
}
Program: 106594
Project: 106594
Buggy source:
@Override public ExtractResponse createExtractResponse(Long uploadId,Long id,Long zoneId,Long accountId,String mode){
  UploadVO uploadInfo=ApiDBUtils.findUploadById(uploadId);
  ExtractResponse response=new ExtractResponse();
  response.setObjectName("String_Node_Str");
  response.setId(id);
  response.setName(ApiDBUtils.findTemplateById(id).getName());
  response.setZoneId(zoneId);
  response.setZoneName(ApiDBUtils.findZoneById(zoneId).getName());
  response.setMode(mode);
  response.setUploadId(uploadId);
  response.setState(uploadInfo.getUploadState().toString());
  response.setAccountId(accountId);
  response.setUrl(uploadInfo.getUploadUrl());
  return response;
}

Fixed version (ground truth):
@Override public ExtractResponse createExtractResponse(Long uploadId,Long id,Long zoneId,Long accountId,String mode){
  UploadVO uploadInfo=ApiDBUtils.findUploadById(uploadId);
  ExtractResponse response=new ExtractResponse();
  response.setObjectName("String_Node_Str");
  response.setId(id);
  response.setName(ApiDBUtils.findTemplateById(id).getName());
  if (zoneId != null) {
    response.setZoneId(zoneId);
    response.setZoneName(ApiDBUtils.findZoneById(zoneId).getName());
  }
  response.setMode(mode);
  response.setUploadId(uploadId);
  response.setState(uploadInfo.getUploadState().toString());
  response.setAccountId(accountId);
  response.setUrl(uploadInfo.getUploadUrl());
  return response;
}
Program: 106596
Project: 106596
Buggy source:
@Override public Map<Capability,String> getNetworkServiceCapabilities(long networkId,Service service){
  if (!areServicesSupportedInNetwork(networkId,service)) {
    throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ networkId);
  }
  Map<Capability,String> serviceCapabilities=new HashMap<Capability,String>();
  String provider=_ntwkSrvcDao.getProviderForServiceInNetwork(networkId,service);
  NetworkElement element=getElementImplementingProvider(provider);
  if (element != null) {
    Map<Service,Map<Capability,String>> elementCapabilities=element.getCapabilities();
    ;
    if (elementCapabilities == null || elementCapabilities.get(service) == null) {
      throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ element.getName()+ "String_Node_Str"+ provider);
    }
    serviceCapabilities=elementCapabilities.get(service);
  }
  return serviceCapabilities;
}

Fixed version (ground truth):
@Override public Map<Capability,String> getNetworkServiceCapabilities(long networkId,Service service){
  if (!areServicesSupportedInNetwork(networkId,service)) {
    throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ networkId);
  }
  Map<Capability,String> serviceCapabilities=new HashMap<Capability,String>();
  String provider=_ntwkSrvcDao.getProviderForServiceInNetwork(networkId,service);
  NetworkElement element=getElementImplementingProvider(provider);
  if (element != null) {
    Map<Service,Map<Capability,String>> elementCapabilities=element.getCapabilities();
    ;
    if (elementCapabilities == null || !elementCapabilities.containsKey(service)) {
      throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ element.getName()+ "String_Node_Str"+ provider);
    }
    serviceCapabilities=elementCapabilities.get(service);
  }
  return serviceCapabilities;
}
Program: 106597
Project: 106597
Buggy source:
@Override public Map<Capability,String> getNetworkOfferingServiceCapabilities(NetworkOffering offering,Service service){
  if (!areServicesSupportedByNetworkOffering(offering.getId(),service)) {
    throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ offering);
  }
  Map<Capability,String> serviceCapabilities=new HashMap<Capability,String>();
  List<String> providers=_ntwkOfferingSrvcDao.listProvidersForServiceForNetworkOffering(offering.getId(),service);
  if (providers.isEmpty()) {
    throw new InvalidParameterValueException("String_Node_Str" + service.getName() + "String_Node_Str"+ offering);
  }
  String provider=providers.get(0);
  NetworkElement element=getElementImplementingProvider(provider);
  if (element != null) {
    Map<Service,Map<Capability,String>> elementCapabilities=element.getCapabilities();
    ;
    if (elementCapabilities == null || elementCapabilities.get(service) == null) {
      throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ element.getName()+ "String_Node_Str"+ provider);
    }
    serviceCapabilities=elementCapabilities.get(service);
  }
  return serviceCapabilities;
}

Fixed version (ground truth):
@Override public Map<Capability,String> getNetworkOfferingServiceCapabilities(NetworkOffering offering,Service service){
  if (!areServicesSupportedByNetworkOffering(offering.getId(),service)) {
    throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ offering);
  }
  Map<Capability,String> serviceCapabilities=new HashMap<Capability,String>();
  List<String> providers=_ntwkOfferingSrvcDao.listProvidersForServiceForNetworkOffering(offering.getId(),service);
  if (providers.isEmpty()) {
    throw new InvalidParameterValueException("String_Node_Str" + service.getName() + "String_Node_Str"+ offering);
  }
  String provider=providers.get(0);
  NetworkElement element=getElementImplementingProvider(provider);
  if (element != null) {
    Map<Service,Map<Capability,String>> elementCapabilities=element.getCapabilities();
    ;
    if (elementCapabilities == null || !elementCapabilities.containsKey(service)) {
      throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ element.getName()+ "String_Node_Str"+ provider);
    }
    serviceCapabilities=elementCapabilities.get(service);
  }
  return serviceCapabilities;
}
Program: 106598
Project: 106598
Buggy source:
@Override public Map<Capability,String> getNetworkServiceCapabilities(long networkId,Service service){
  if (!areServicesSupportedInNetwork(networkId,service)) {
    throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ networkId);
  }
  Map<Capability,String> serviceCapabilities=new HashMap<Capability,String>();
  String provider=_ntwkSrvcDao.getProviderForServiceInNetwork(networkId,service);
  NetworkElement element=getElementImplementingProvider(provider);
  if (element != null) {
    Map<Service,Map<Capability,String>> elementCapabilities=element.getCapabilities();
    ;
    if (elementCapabilities == null || elementCapabilities.get(service) == null) {
      throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ element.getName()+ "String_Node_Str"+ provider);
    }
    serviceCapabilities=elementCapabilities.get(service);
  }
  return serviceCapabilities;
}

Fixed version (ground truth):
@Override public Map<Capability,String> getNetworkServiceCapabilities(long networkId,Service service){
  if (!areServicesSupportedInNetwork(networkId,service)) {
    throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ networkId);
  }
  Map<Capability,String> serviceCapabilities=new HashMap<Capability,String>();
  String provider=_ntwkSrvcDao.getProviderForServiceInNetwork(networkId,service);
  NetworkElement element=getElementImplementingProvider(provider);
  if (element != null) {
    Map<Service,Map<Capability,String>> elementCapabilities=element.getCapabilities();
    ;
    if (elementCapabilities == null || !elementCapabilities.containsKey(service)) {
      throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ element.getName()+ "String_Node_Str"+ provider);
    }
    serviceCapabilities=elementCapabilities.get(service);
  }
  return serviceCapabilities;
}
Program: 106599
Project: 106599
Buggy source:
@Override public Map<Capability,String> getNetworkOfferingServiceCapabilities(NetworkOffering offering,Service service){
  if (!areServicesSupportedByNetworkOffering(offering.getId(),service)) {
    throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ offering);
  }
  Map<Capability,String> serviceCapabilities=new HashMap<Capability,String>();
  List<String> providers=_ntwkOfferingSrvcDao.listProvidersForServiceForNetworkOffering(offering.getId(),service);
  if (providers.isEmpty()) {
    throw new InvalidParameterValueException("String_Node_Str" + service.getName() + "String_Node_Str"+ offering);
  }
  String provider=providers.get(0);
  NetworkElement element=getElementImplementingProvider(provider);
  if (element != null) {
    Map<Service,Map<Capability,String>> elementCapabilities=element.getCapabilities();
    ;
    if (elementCapabilities == null || elementCapabilities.get(service) == null) {
      throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ element.getName()+ "String_Node_Str"+ provider);
    }
    serviceCapabilities=elementCapabilities.get(service);
  }
  return serviceCapabilities;
}

Fixed version (ground truth):
@Override public Map<Capability,String> getNetworkOfferingServiceCapabilities(NetworkOffering offering,Service service){
  if (!areServicesSupportedByNetworkOffering(offering.getId(),service)) {
    throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ offering);
  }
  Map<Capability,String> serviceCapabilities=new HashMap<Capability,String>();
  List<String> providers=_ntwkOfferingSrvcDao.listProvidersForServiceForNetworkOffering(offering.getId(),service);
  if (providers.isEmpty()) {
    throw new InvalidParameterValueException("String_Node_Str" + service.getName() + "String_Node_Str"+ offering);
  }
  String provider=providers.get(0);
  NetworkElement element=getElementImplementingProvider(provider);
  if (element != null) {
    Map<Service,Map<Capability,String>> elementCapabilities=element.getCapabilities();
    ;
    if (elementCapabilities == null || !elementCapabilities.containsKey(service)) {
      throw new UnsupportedServiceException("String_Node_Str" + service.getName() + "String_Node_Str"+ element.getName()+ "String_Node_Str"+ provider);
    }
    serviceCapabilities=elementCapabilities.get(service);
  }
  return serviceCapabilities;
}
Program: 106601
Project: 106601
Buggy source:
@Override public long findCorrectResourceLimitForAccount(Account account,ResourceType type){
  long max=-1;
  ResourceLimitVO limit=_resourceLimitDao.findByOwnerIdAndType(account.getId(),ResourceOwnerType.Account,type);
  if (limit != null) {
    max=limit.getMax().longValue();
  }
 else {
    Long value=null;
    if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
      value=projectResourceLimitMap.get(type);
    }
 else {
      value=accountResourceLimitMap.get(type);
    }
    if (value != null) {
      return value;
    }
  }
  return max;
}

Fixed version (ground truth):
@Override public long findCorrectResourceLimitForAccount(Account account,ResourceType type){
  long max=Resource.RESOURCE_UNLIMITED;
  ResourceLimitVO limit=_resourceLimitDao.findByOwnerIdAndType(account.getId(),ResourceOwnerType.Account,type);
  if (limit != null) {
    max=limit.getMax().longValue();
  }
 else {
    Long value=null;
    if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
      value=projectResourceLimitMap.get(type);
    }
 else {
      value=accountResourceLimitMap.get(type);
    }
    if (value != null) {
      return value;
    }
  }
  return max;
}
Program: 106602
Project: 106602
Buggy source:
@Override public long findCorrectResourceLimitForDomain(Domain domain,ResourceType type){
  long max=-1;
  ResourceLimitVO limit=_resourceLimitDao.findByOwnerIdAndType(domain.getId(),ResourceOwnerType.Domain,type);
  if (limit != null) {
    max=limit.getMax().longValue();
  }
 else {
    Long domainId=domain.getParent();
    while ((domainId != null) && (limit == null)) {
      limit=_resourceLimitDao.findByOwnerIdAndType(domainId,ResourceOwnerType.Domain,type);
      DomainVO tmpDomain=_domainDao.findById(domainId);
      domainId=tmpDomain.getParent();
    }
    if (limit != null) {
      max=limit.getMax().longValue();
    }
  }
  return max;
}

Fixed version (ground truth):
@Override public long findCorrectResourceLimitForDomain(Domain domain,ResourceType type){
  long max=Resource.RESOURCE_UNLIMITED;
  ResourceLimitVO limit=_resourceLimitDao.findByOwnerIdAndType(domain.getId(),ResourceOwnerType.Domain,type);
  if (limit != null) {
    max=limit.getMax().longValue();
  }
 else {
    Long domainId=domain.getParent();
    while ((domainId != null) && (limit == null)) {
      limit=_resourceLimitDao.findByOwnerIdAndType(domainId,ResourceOwnerType.Domain,type);
      DomainVO tmpDomain=_domainDao.findById(domainId);
      domainId=tmpDomain.getParent();
    }
    if (limit != null) {
      max=limit.getMax().longValue();
    }
  }
  return max;
}
Program: 106605
Project: 106605
Buggy source:
@Override public List<? extends ProjectAccount> listProjectAccounts(long projectId,String accountName,String role,Long startIndex,Long pageSizeVal){
  Account caller=UserContext.current().getCaller();
  Project project=getProject(projectId);
  if (project == null) {
    throw new InvalidParameterValueException("String_Node_Str" + projectId);
  }
  if (!_accountMgr.isAdmin(caller.getType()) && _projectAccountDao.findByProjectIdAccountId(projectId,caller.getAccountId()) == null) {
    throw new PermissionDeniedException("String_Node_Str" + caller + "String_Node_Str"+ projectId);
  }
  Filter searchFilter=new Filter(ProjectAccountVO.class,"String_Node_Str",false,startIndex,pageSizeVal);
  SearchBuilder<ProjectAccountVO> sb=_projectAccountDao.createSearchBuilder();
  sb.and("String_Node_Str",sb.entity().getAccountRole(),Op.EQ);
  SearchBuilder<AccountVO> accountSearch;
  if (accountName != null) {
    accountSearch=_accountDao.createSearchBuilder();
    accountSearch.and("String_Node_Str",accountSearch.entity().getAccountName(),SearchCriteria.Op.EQ);
    sb.join("String_Node_Str",accountSearch,sb.entity().getAccountId(),accountSearch.entity().getId(),JoinBuilder.JoinType.INNER);
  }
  SearchCriteria<ProjectAccountVO> sc=sb.create();
  if (role != null) {
    sc.setParameters("String_Node_Str",role);
  }
  if (accountName != null) {
    sc.setJoinParameters("String_Node_Str","String_Node_Str",accountName);
  }
  return _projectAccountDao.search(sc,searchFilter);
}

Fixed version (ground truth):
@Override public List<? extends ProjectAccount> listProjectAccounts(long projectId,String accountName,String role,Long startIndex,Long pageSizeVal){
  Account caller=UserContext.current().getCaller();
  Project project=getProject(projectId);
  if (project == null) {
    throw new InvalidParameterValueException("String_Node_Str" + projectId);
  }
  if (!_accountMgr.isAdmin(caller.getType()) && _projectAccountDao.findByProjectIdAccountId(projectId,caller.getAccountId()) == null) {
    throw new PermissionDeniedException("String_Node_Str" + caller + "String_Node_Str"+ projectId);
  }
  Filter searchFilter=new Filter(ProjectAccountVO.class,"String_Node_Str",false,startIndex,pageSizeVal);
  SearchBuilder<ProjectAccountVO> sb=_projectAccountDao.createSearchBuilder();
  sb.and("String_Node_Str",sb.entity().getAccountRole(),Op.EQ);
  sb.and("String_Node_Str",sb.entity().getProjectId(),Op.EQ);
  SearchBuilder<AccountVO> accountSearch;
  if (accountName != null) {
    accountSearch=_accountDao.createSearchBuilder();
    accountSearch.and("String_Node_Str",accountSearch.entity().getAccountName(),SearchCriteria.Op.EQ);
    sb.join("String_Node_Str",accountSearch,sb.entity().getAccountId(),accountSearch.entity().getId(),JoinBuilder.JoinType.INNER);
  }
  SearchCriteria<ProjectAccountVO> sc=sb.create();
  sc.setParameters("String_Node_Str",projectId);
  if (role != null) {
    sc.setParameters("String_Node_Str",role);
  }
  if (accountName != null) {
    sc.setJoinParameters("String_Node_Str","String_Node_Str",accountName);
  }
  return _projectAccountDao.search(sc,searchFilter);
}