Program: 35108
Project: 35108
Buggy source:
@Override public Page<Map<String,Object>> getAgentList(String keyword,String depositAddress,String agentAddress,String sortType,Integer pageNumber,Integer pageSize){
  List<Consensus<Agent>> agentList=this.getEffectiveAgentList(agentAddress,NulsContext.getInstance().getBestHeight(),null);
  filterAgentList(agentList,depositAddress,keyword);
  Page<Map<String,Object>> page=new Page<>();
  int start=pageNumber * pageSize - pageSize;
  if (agentList.isEmpty() || start >= agentList.size()) {
    if (StringUtils.isNotBlank(depositAddress)) {
      Consensus<Agent> ca=this.getAgentByAddress(depositAddress);
      if (null != ca) {
        agentList.add(0,ca);
      }
    }
    fillConsensusInfo(agentList);
    page.setPageNumber(pageNumber);
    page.setPageSize(pageSize);
    page.setTotal(agentList.size());
    int sum=0;
    if (page.getTotal() % pageSize > 0) {
      sum=1;
    }
    page.setList(transList(agentList));
    page.setPages((int)((page.getTotal() / pageSize) + sum));
    return page;
  }
  int end=pageNumber * pageSize;
  if (end > agentList.size()) {
    end=agentList.size();
  }
  int type=AgentComparator.COMMISSION_RATE;
  if ("String_Node_Str".equals(sortType)) {
    type=AgentComparator.DEPOSIT;
  }
 else   if ("String_Node_Str".equals(sortType)) {
    type=AgentComparator.COMMISSION_RATE;
  }
 else   if ("String_Node_Str".equals(sortType)) {
    type=AgentComparator.CREDIT_VALUE;
  }
 else   if ("String_Node_Str".equals(sortType)) {
    type=AgentComparator.DEPOSITABLE;
  }
  if (StringUtils.isNotBlank(depositAddress)) {
    boolean b=true;
    for (int i=0; i < agentList.size(); i++) {
      Consensus<Agent> ca=agentList.get(i);
      if (ca.getAddress().equals(depositAddress)) {
        agentList.remove(i);
        agentList.add(0,ca);
        b=false;
        break;
      }
    }
    if (b) {
      Consensus<Agent> ca=this.getAgentByAddress(depositAddress);
      if (null != ca) {
        agentList.add(0,ca);
      }
    }
  }
  List<Consensus<Agent>> sublist=agentList.subList(start,end);
  fillConsensusInfo(sublist);
  page.setPageNumber(pageNumber);
  page.setPageSize(pageSize);
  page.setTotal(agentList.size());
  int sum=0;
  if (page.getTotal() % pageSize > 0) {
    sum=1;
  }
  page.setPages((int)((page.getTotal() / pageSize) + sum));
  Collections.sort(sublist,AgentComparator.getInstance(type));
  List<Map<String,Object>> resultList=transList(sublist);
  page.setList(resultList);
  return page;
}

Fixed version (ground truth):
@Override public Page<Map<String,Object>> getAgentList(String keyword,String depositAddress,String agentAddress,String sortType,Integer pageNumber,Integer pageSize){
  List<Consensus<Agent>> agentList=this.getEffectiveAgentList(agentAddress,NulsContext.getInstance().getBestHeight(),null);
  filterAgentList(agentList,depositAddress,keyword);
  Page<Map<String,Object>> page=new Page<>();
  int start=pageNumber * pageSize - pageSize;
  if (agentList.isEmpty() || start >= agentList.size()) {
    if (StringUtils.isNotBlank(depositAddress)) {
      Consensus<Agent> ca=this.getAgentByAddress(depositAddress);
      if (null != ca) {
        agentList.add(0,ca);
      }
    }
    int end=pageNumber * pageSize;
    if (end > agentList.size()) {
      end=agentList.size();
    }
    fillConsensusInfo(agentList);
    List<Consensus<Agent>> sublist=agentList.subList(start,end);
    page.setPageNumber(pageNumber);
    page.setPageSize(pageSize);
    page.setTotal(agentList.size());
    int sum=0;
    if (page.getTotal() % pageSize > 0) {
      sum=1;
    }
    page.setList(transList(sublist));
    page.setPages((int)((page.getTotal() / pageSize) + sum));
    return page;
  }
  int type=AgentComparator.COMMISSION_RATE;
  if ("String_Node_Str".equals(sortType)) {
    type=AgentComparator.DEPOSIT;
  }
 else   if ("String_Node_Str".equals(sortType)) {
    type=AgentComparator.COMMISSION_RATE;
  }
 else   if ("String_Node_Str".equals(sortType)) {
    type=AgentComparator.CREDIT_VALUE;
  }
 else   if ("String_Node_Str".equals(sortType)) {
    type=AgentComparator.DEPOSITABLE;
  }
  if (StringUtils.isNotBlank(depositAddress)) {
    boolean b=true;
    for (int i=0; i < agentList.size(); i++) {
      Consensus<Agent> ca=agentList.get(i);
      if (ca.getAddress().equals(depositAddress)) {
        agentList.remove(i);
        agentList.add(0,ca);
        b=false;
        break;
      }
    }
    if (b) {
      Consensus<Agent> ca=this.getAgentByAddress(depositAddress);
      if (null != ca) {
        agentList.add(0,ca);
      }
    }
  }
  int end=pageNumber * pageSize;
  if (end > agentList.size()) {
    end=agentList.size();
  }
  fillConsensusInfo(agentList);
  List<Consensus<Agent>> sublist=agentList.subList(start,end);
  page.setPageNumber(pageNumber);
  page.setPageSize(pageSize);
  page.setTotal(agentList.size());
  int sum=0;
  if (page.getTotal() % pageSize > 0) {
    sum=1;
  }
  page.setPages((int)((page.getTotal() / pageSize) + sum));
  Collections.sort(sublist,AgentComparator.getInstance(type));
  List<Map<String,Object>> resultList=transList(sublist);
  page.setList(resultList);
  return page;
}