Program: 106551
Project: 106551
Buggy source:
@Override public List<? extends ProjectInvitation> listProjectInvitations(Long id,Long projectId,String accountName,Long domainId,String state,boolean activeOnly,Long startIndex,Long pageSizeVal,boolean isRecursive,boolean listAll){
  Account caller=UserContext.current().getCaller();
  List<Long> permittedAccounts=new ArrayList<Long>();
  Ternary<Long,Boolean,ListProjectResourcesCriteria> domainIdRecursiveListProject=new Ternary<Long,Boolean,ListProjectResourcesCriteria>(domainId,isRecursive,null);
  _accountMgr.buildACLSearchParameters(caller,id,accountName,projectId,permittedAccounts,domainIdRecursiveListProject,listAll);
  domainId=domainIdRecursiveListProject.first();
  isRecursive=domainIdRecursiveListProject.second();
  ListProjectResourcesCriteria listProjectResourcesCriteria=domainIdRecursiveListProject.third();
  Filter searchFilter=new Filter(ProjectInvitationVO.class,"String_Node_Str",true,startIndex,pageSizeVal);
  SearchBuilder<ProjectInvitationVO> sb=_projectInvitationDao.createSearchBuilder();
  _accountMgr.buildACLSearchBuilder(sb,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  sb.and("String_Node_Str",sb.entity().getProjectId(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getState(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getCreated(),SearchCriteria.Op.GT);
  sb.and("String_Node_Str",sb.entity().getId(),SearchCriteria.Op.EQ);
  SearchCriteria<ProjectInvitationVO> sc=sb.create();
  _accountMgr.buildACLSearchCriteria(sc,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  if (projectId != null) {
    sc.setParameters("String_Node_Str",projectId);
  }
  if (state != null) {
    sc.setParameters("String_Node_Str",state);
  }
  if (id != null) {
    sc.setParameters("String_Node_Str",id);
  }
  if (activeOnly) {
    sc.setParameters("String_Node_Str",ProjectInvitation.State.Pending);
    sc.setParameters("String_Node_Str",new Date((DateUtil.currentGMTTime().getTime()) - _invitationTimeOut));
  }
  return _projectInvitationDao.search(sc,searchFilter);
}

Fixed version (ground truth):
@Override public List<? extends ProjectInvitation> listProjectInvitations(Long id,Long projectId,String accountName,Long domainId,String state,boolean activeOnly,Long startIndex,Long pageSizeVal,boolean isRecursive,boolean listAll){
  Account caller=UserContext.current().getCaller();
  List<Long> permittedAccounts=new ArrayList<Long>();
  Ternary<Long,Boolean,ListProjectResourcesCriteria> domainIdRecursiveListProject=new Ternary<Long,Boolean,ListProjectResourcesCriteria>(domainId,isRecursive,null);
  _accountMgr.buildACLSearchParameters(caller,id,accountName,projectId,permittedAccounts,domainIdRecursiveListProject,listAll,true);
  domainId=domainIdRecursiveListProject.first();
  isRecursive=domainIdRecursiveListProject.second();
  ListProjectResourcesCriteria listProjectResourcesCriteria=domainIdRecursiveListProject.third();
  Filter searchFilter=new Filter(ProjectInvitationVO.class,"String_Node_Str",true,startIndex,pageSizeVal);
  SearchBuilder<ProjectInvitationVO> sb=_projectInvitationDao.createSearchBuilder();
  _accountMgr.buildACLSearchBuilder(sb,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  sb.and("String_Node_Str",sb.entity().getProjectId(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getState(),SearchCriteria.Op.EQ);
  sb.and("String_Node_Str",sb.entity().getCreated(),SearchCriteria.Op.GT);
  sb.and("String_Node_Str",sb.entity().getId(),SearchCriteria.Op.EQ);
  SearchCriteria<ProjectInvitationVO> sc=sb.create();
  _accountMgr.buildACLSearchCriteria(sc,domainId,isRecursive,permittedAccounts,listProjectResourcesCriteria);
  if (projectId != null) {
    sc.setParameters("String_Node_Str",projectId);
  }
  if (state != null) {
    sc.setParameters("String_Node_Str",state);
  }
  if (id != null) {
    sc.setParameters("String_Node_Str",id);
  }
  if (activeOnly) {
    sc.setParameters("String_Node_Str",ProjectInvitation.State.Pending);
    sc.setParameters("String_Node_Str",new Date((DateUtil.currentGMTTime().getTime()) - _invitationTimeOut));
  }
  return _projectInvitationDao.search(sc,searchFilter);
}