Program: 35168
Project: 35168
Buggy source:
private void nextRound() throws NulsException, IOException {
  consensusManager.initConsensusStatusInfo();
  PocMeetingRound currentRound=calcRound();
  consensusManager.setCurrentRound(currentRound);
  while (TimeService.currentTimeMillis() < (currentRound.getStartTime())) {
    try {
      Thread.sleep(100L);
    }
 catch (    InterruptedException e) {
      Log.error(e);
    }
  }
  boolean imIn=consensusManager.isPartakePacking();
  List<Consensus<Agent>> list=calcConsensusAgentList();
  currentRound.setMemberCount(list.size());
  while (currentRound.getEndTime() < TimeService.currentTimeMillis()) {
    long time=TimeService.currentTimeMillis() - currentRound.getStartTime();
    long roundTime=currentRound.getEndTime() - currentRound.getStartTime();
    long index=time / roundTime;
    long startTime=currentRound.getStartTime() + index * roundTime;
    currentRound.setStartTime(startTime);
  }
  Map<String,List<Consensus<Delegate>>> delegateMap=new HashMap<>();
  List<Consensus<Delegate>> delegateList=consensusCacheManager.getCachedDelegateList();
  for (  Consensus<Delegate> cd : delegateList) {
    List<Consensus<Delegate>> sonList=delegateMap.get(cd.getExtend().getDelegateAddress());
    if (null == sonList) {
      sonList=new ArrayList<>();
    }
    sonList.add(cd);
    delegateMap.put(cd.getExtend().getDelegateAddress(),sonList);
  }
  List<PocMeetingMember> memberList=new ArrayList<>();
  Na totalDeposit=Na.ZERO;
  for (  Consensus<Agent> ca : list) {
    boolean isSeed=ca.getExtend().getSeed();
    if (!isSeed && ca.getExtend().getDeposit().isLessThan(PocConsensusConstant.AGENT_DEPOSIT_LOWER_LIMIT)) {
      continue;
    }
    PocMeetingMember mm=new PocMeetingMember();
    mm.setAgentConsensus(ca);
    mm.setDelegateList(delegateMap.get(ca.getAddress()));
    if (!isSeed && (mm.getDelegateList() == null || mm.getDelegateList().size() > PocConsensusConstant.MAX_ACCEPT_NUM_OF_DELEGATE)) {
      continue;
    }
    mm.calcDeposit();
    if (!isSeed && mm.getTotolEntrustDeposit().isLessThan(PocConsensusConstant.SUM_OF_DEPOSIT_OF_AGENT_LOWER_LIMIT)) {
      continue;
    }
    mm.setRoundIndex(currentRound.getIndex());
    mm.setAddress(ca.getAddress());
    mm.setPackerAddress(ca.getExtend().getDelegateAddress());
    mm.setRoundStartTime(currentRound.getStartTime());
    memberList.add(mm);
    totalDeposit=totalDeposit.add(ca.getExtend().getDeposit());
  }
  Collections.sort(memberList);
  currentRound.setMemberList(memberList);
  currentRound.setTotalDeposit(totalDeposit);
  if (imIn) {
    startMeeting();
  }
}

Fixed version (ground truth):
private void nextRound() throws NulsException, IOException {
  consensusManager.initConsensusStatusInfo();
  PocMeetingRound currentRound=calcRound();
  consensusManager.setCurrentRound(currentRound);
  while (TimeService.currentTimeMillis() < (currentRound.getStartTime())) {
    try {
      Thread.sleep(100L);
    }
 catch (    InterruptedException e) {
      Log.error(e);
    }
  }
  boolean imIn=consensusManager.isPartakePacking();
  List<Consensus<Agent>> list=calcConsensusAgentList();
  currentRound.setMemberCount(list.size());
  while (currentRound.getEndTime() < TimeService.currentTimeMillis()) {
    long time=TimeService.currentTimeMillis() - currentRound.getStartTime();
    long roundTime=currentRound.getEndTime() - currentRound.getStartTime();
    long index=time / roundTime;
    long startTime=currentRound.getStartTime() + index * roundTime;
    currentRound.setStartTime(startTime);
  }
  Map<String,List<Consensus<Delegate>>> delegateMap=new HashMap<>();
  List<Consensus<Delegate>> delegateList=consensusCacheManager.getCachedDelegateList();
  for (  Consensus<Delegate> cd : delegateList) {
    List<Consensus<Delegate>> sonList=delegateMap.get(cd.getExtend().getDelegateAddress());
    if (null == sonList) {
      sonList=new ArrayList<>();
    }
    sonList.add(cd);
    delegateMap.put(cd.getExtend().getDelegateAddress(),sonList);
  }
  List<PocMeetingMember> memberList=new ArrayList<>();
  Na totalDeposit=Na.ZERO;
  for (  Consensus<Agent> ca : list) {
    boolean isSeed=ca.getExtend().getSeed();
    if (!isSeed && ca.getExtend().getDeposit().isLessThan(PocConsensusConstant.AGENT_DEPOSIT_LOWER_LIMIT)) {
      continue;
    }
    PocMeetingMember mm=new PocMeetingMember();
    mm.setAgentConsensus(ca);
    mm.setDelegateList(delegateMap.get(ca.getAddress()));
    if (!isSeed && (mm.getDelegateList() == null || mm.getDelegateList().size() > PocConsensusConstant.MAX_ACCEPT_NUM_OF_DELEGATE)) {
      continue;
    }
    mm.calcDeposit();
    if (!isSeed && mm.getTotolEntrustDeposit().isLessThan(PocConsensusConstant.SUM_OF_DEPOSIT_OF_AGENT_LOWER_LIMIT)) {
      continue;
    }
    mm.setRoundIndex(currentRound.getIndex());
    mm.setAddress(ca.getAddress());
    mm.setPackerAddress(ca.getExtend().getAgentAddress());
    mm.setRoundStartTime(currentRound.getStartTime());
    memberList.add(mm);
    totalDeposit=totalDeposit.add(ca.getExtend().getDeposit());
  }
  Collections.sort(memberList);
  currentRound.setMemberList(memberList);
  currentRound.setTotalDeposit(totalDeposit);
  if (imIn) {
    startMeeting();
  }
}