Program: 89176
Project: 89176
Buggy source:
@Override public List<DomainRouterVO> searchForRouters(ListRoutersCmd cmd){
  Long id=cmd.getId();
  String name=cmd.getRouterName();
  String state=cmd.getState();
  Long zone=cmd.getZoneId();
  Long pod=cmd.getPodId();
  Long hostId=cmd.getHostId();
  String keyword=cmd.getKeyword();
  Long networkId=cmd.getNetworkId();
  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,id,cmd.getAccountName(),cmd.getProjectId(),permittedAccounts,domainIdRecursiveListProject,cmd.listAll());
  Long domainId=domainIdRecursiveListProject.first();
  Boolean isRecursive=domainIdRecursiveListProject.second();
  ListProjectResourcesCriteria listProjectResourcesCriteria=domainIdRecursiveListProject.third();
  Filter searchFilter=new Filter(DomainRouterVO.class,"String_Node_Str",true,cmd.getStartIndex(),cmd.getPageSizeVal());
  SearchBuilder<DomainRouterVO> sb=_routerDao.createSearchBuilder();
  _accountMgr.buildACLSearchBuilder(sb,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  sb.and("String_Node_Str",sb.entity().getHostName(),SearchCriteria.Op.LIKE);
  sb.and("String_Node_Str",sb.entity().getId(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getAccountId(),SearchCriteria.Op.IN);
  sb.and("String_Node_Str",sb.entity().getState(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getDataCenterIdToDeployIn(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getPodIdToDeployIn(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getHostId(),SearchCriteria.Op.EQ);
  if (networkId != null) {
    SearchBuilder<NicVO> nicSearch=_nicDao.createSearchBuilder();
    nicSearch.and("String_Node_Str",nicSearch.entity().getNetworkId(),SearchCriteria.Op.EQ);
    SearchBuilder<NetworkVO> networkSearch=_networkDao.createSearchBuilder();
    networkSearch.and("String_Node_Str",networkSearch.entity().getId(),SearchCriteria.Op.EQ);
    nicSearch.join("String_Node_Str",networkSearch,nicSearch.entity().getNetworkId(),networkSearch.entity().getId(),JoinBuilder.JoinType.INNER);
    sb.join("String_Node_Str",nicSearch,sb.entity().getId(),nicSearch.entity().getInstanceId(),JoinBuilder.JoinType.INNER);
  }
  SearchCriteria<DomainRouterVO> sc=sb.create();
  _accountMgr.buildACLSearchCriteria(sc,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  if (keyword != null) {
    SearchCriteria<DomainRouterVO> ssc=_routerDao.createSearchCriteria();
    ssc.addOr("String_Node_Str",SearchCriteria.Op.LIKE,"String_Node_Str" + keyword + "String_Node_Str");
    ssc.addOr("String_Node_Str",SearchCriteria.Op.LIKE,"String_Node_Str" + keyword + "String_Node_Str");
    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 (name != null) {
    sc.setParameters("String_Node_Str","String_Node_Str" + name + "String_Node_Str");
  }
  if (id != null) {
    sc.setParameters("String_Node_Str",id);
  }
  if (state != null) {
    sc.setParameters("String_Node_Str",state);
  }
  if (zone != null) {
    sc.setParameters("String_Node_Str",zone);
  }
  if (pod != null) {
    sc.setParameters("String_Node_Str",pod);
  }
  if (hostId != null) {
    sc.setParameters("String_Node_Str",hostId);
  }
  if (networkId != null) {
    sc.setJoinParameters("String_Node_Str","String_Node_Str",networkId);
  }
  return _routerDao.search(sc,searchFilter);
}

Fixed version (ground truth):
@Override public List<DomainRouterVO> searchForRouters(ListRoutersCmd cmd){
  Long id=cmd.getId();
  String name=cmd.getRouterName();
  String state=cmd.getState();
  Long zone=cmd.getZoneId();
  Long pod=cmd.getPodId();
  Long hostId=cmd.getHostId();
  String keyword=cmd.getKeyword();
  Long networkId=cmd.getNetworkId();
  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,id,cmd.getAccountName(),cmd.getProjectId(),permittedAccounts,domainIdRecursiveListProject,cmd.listAll(),false);
  Long domainId=domainIdRecursiveListProject.first();
  Boolean isRecursive=domainIdRecursiveListProject.second();
  ListProjectResourcesCriteria listProjectResourcesCriteria=domainIdRecursiveListProject.third();
  Filter searchFilter=new Filter(DomainRouterVO.class,"String_Node_Str",true,cmd.getStartIndex(),cmd.getPageSizeVal());
  SearchBuilder<DomainRouterVO> sb=_routerDao.createSearchBuilder();
  _accountMgr.buildACLSearchBuilder(sb,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  sb.and("String_Node_Str",sb.entity().getHostName(),SearchCriteria.Op.LIKE);
  sb.and("String_Node_Str",sb.entity().getId(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getAccountId(),SearchCriteria.Op.IN);
  sb.and("String_Node_Str",sb.entity().getState(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getDataCenterIdToDeployIn(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getPodIdToDeployIn(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getHostId(),SearchCriteria.Op.EQ);
  if (networkId != null) {
    SearchBuilder<NicVO> nicSearch=_nicDao.createSearchBuilder();
    nicSearch.and("String_Node_Str",nicSearch.entity().getNetworkId(),SearchCriteria.Op.EQ);
    SearchBuilder<NetworkVO> networkSearch=_networkDao.createSearchBuilder();
    networkSearch.and("String_Node_Str",networkSearch.entity().getId(),SearchCriteria.Op.EQ);
    nicSearch.join("String_Node_Str",networkSearch,nicSearch.entity().getNetworkId(),networkSearch.entity().getId(),JoinBuilder.JoinType.INNER);
    sb.join("String_Node_Str",nicSearch,sb.entity().getId(),nicSearch.entity().getInstanceId(),JoinBuilder.JoinType.INNER);
  }
  SearchCriteria<DomainRouterVO> sc=sb.create();
  _accountMgr.buildACLSearchCriteria(sc,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  if (keyword != null) {
    SearchCriteria<DomainRouterVO> ssc=_routerDao.createSearchCriteria();
    ssc.addOr("String_Node_Str",SearchCriteria.Op.LIKE,"String_Node_Str" + keyword + "String_Node_Str");
    ssc.addOr("String_Node_Str",SearchCriteria.Op.LIKE,"String_Node_Str" + keyword + "String_Node_Str");
    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 (name != null) {
    sc.setParameters("String_Node_Str","String_Node_Str" + name + "String_Node_Str");
  }
  if (id != null) {
    sc.setParameters("String_Node_Str",id);
  }
  if (state != null) {
    sc.setParameters("String_Node_Str",state);
  }
  if (zone != null) {
    sc.setParameters("String_Node_Str",zone);
  }
  if (pod != null) {
    sc.setParameters("String_Node_Str",pod);
  }
  if (hostId != null) {
    sc.setParameters("String_Node_Str",hostId);
  }
  if (networkId != null) {
    sc.setJoinParameters("String_Node_Str","String_Node_Str",networkId);
  }
  return _routerDao.search(sc,searchFilter);
}