Program: 172105
Project: 172105
Buggy source:
public CannedQuery<AuthorityInfo> getCannedQuery(AuthorityType type,NodeRef containerRef,String displayNameFilter,boolean sortByDisplayName,boolean sortAscending,PagingRequest pagingRequest){
  ParameterCheck.mandatory("String_Node_Str",containerRef);
  ParameterCheck.mandatory("String_Node_Str",pagingRequest);
  int requestTotalCountMax=pagingRequest.getRequestTotalCountMax();
  Pair<Long,NodeRef> nodePair=nodeDAO.getNodePair(tenantService.getName(containerRef));
  if (nodePair == null) {
    throw new InvalidNodeRefException("String_Node_Str" + containerRef,containerRef);
  }
  Long containerNodeId=nodePair.getFirst();
  GetAuthoritiesCannedQueryParams paramBean=new GetAuthoritiesCannedQueryParams(type,containerNodeId,getQNameId(ContentModel.PROP_AUTHORITY_DISPLAY_NAME),displayNameFilter);
  CannedQueryPageDetails cqpd=new CannedQueryPageDetails(pagingRequest.getSkipCount(),pagingRequest.getMaxItems(),CannedQueryPageDetails.DEFAULT_PAGE_NUMBER,CannedQueryPageDetails.DEFAULT_PAGE_COUNT);
  CannedQuerySortDetails cqsd=null;
  if (sortByDisplayName) {
    List<Pair<? extends Object,SortOrder>> sortPairs=new ArrayList<Pair<? extends Object,SortOrder>>(1);
    sortPairs.add(new Pair<String,SortOrder>("String_Node_Str",(sortAscending ? SortOrder.ASCENDING : SortOrder.DESCENDING)));
    cqsd=new CannedQuerySortDetails(sortPairs);
  }
  CannedQueryParameters params=new CannedQueryParameters(paramBean,cqpd,cqsd,requestTotalCountMax,pagingRequest.getQueryExecutionId());
  return getCannedQuery(params);
}

Fixed version (ground truth):
public CannedQuery<AuthorityInfo> getCannedQuery(AuthorityType type,NodeRef containerRef,String displayNameFilter,boolean sortByDisplayName,boolean sortAscending,PagingRequest pagingRequest){
  ParameterCheck.mandatory("String_Node_Str",containerRef);
  ParameterCheck.mandatory("String_Node_Str",pagingRequest);
  int requestTotalCountMax=pagingRequest.getRequestTotalCountMax();
  Pair<Long,NodeRef> nodePair=nodeDAO.getNodePair(tenantService.getName(containerRef));
  if (nodePair == null) {
    throw new InvalidNodeRefException("String_Node_Str" + containerRef,containerRef);
  }
  Long containerNodeId=nodePair.getFirst();
  Long qnameAuthDisplayNameId=Long.MIN_VALUE;
  Pair<Long,QName> qnameAuthDisplayNamePair=qnameDAO.getQName(ContentModel.PROP_AUTHORITY_DISPLAY_NAME);
  if (qnameAuthDisplayNamePair != null) {
    qnameAuthDisplayNameId=qnameAuthDisplayNamePair.getFirst();
  }
  GetAuthoritiesCannedQueryParams paramBean=new GetAuthoritiesCannedQueryParams(type,containerNodeId,qnameAuthDisplayNameId,displayNameFilter);
  CannedQueryPageDetails cqpd=new CannedQueryPageDetails(pagingRequest.getSkipCount(),pagingRequest.getMaxItems(),CannedQueryPageDetails.DEFAULT_PAGE_NUMBER,CannedQueryPageDetails.DEFAULT_PAGE_COUNT);
  CannedQuerySortDetails cqsd=null;
  if (sortByDisplayName) {
    List<Pair<? extends Object,SortOrder>> sortPairs=new ArrayList<Pair<? extends Object,SortOrder>>(1);
    sortPairs.add(new Pair<String,SortOrder>("String_Node_Str",(sortAscending ? SortOrder.ASCENDING : SortOrder.DESCENDING)));
    cqsd=new CannedQuerySortDetails(sortPairs);
  }
  CannedQueryParameters params=new CannedQueryParameters(paramBean,cqpd,cqsd,requestTotalCountMax,pagingRequest.getQueryExecutionId());
  return getCannedQuery(params);
}