Program: 34964
Project: 34964
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=String.class)}) public RpcClientResult getStopAgentFee(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @QueryParam("String_Node_Str") String address) throws NulsException, IOException {
  AssertUtil.canNotEmpty(address,"String_Node_Str");
  if (!AddressTool.validAddress(address)) {
    return Result.getFailed(KernelErrorCode.PARAMETER_ERROR).toRpcClientResult();
  }
  StopAgentTransaction tx=new StopAgentTransaction();
  StopAgent stopAgent=new StopAgent();
  stopAgent.setAddress(AddressTool.getAddress(address));
  List<Agent> agentList=PocConsensusContext.getChainManager().getMasterChain().getChain().getAgentList();
  Agent agent=null;
  for (  Agent a : agentList) {
    if (a.getDelHeight() > 0) {
      continue;
    }
    if (Arrays.equals(a.getAgentAddress(),stopAgent.getAddress())) {
      agent=a;
      break;
    }
  }
  if (agent == null || agent.getDelHeight() > 0) {
    return Result.getFailed(PocConsensusErrorCode.AGENT_NOT_EXIST).toRpcClientResult();
  }
  NulsDigestData createTxHash=agent.getTxHash();
  stopAgent.setCreateTxHash(createTxHash);
  tx.setTxData(stopAgent);
  CoinData coinData=new CoinData();
  List<Coin> toList=new ArrayList<>();
  toList.add(new Coin(stopAgent.getAddress(),agent.getDeposit(),0));
  coinData.setTo(toList);
  CreateAgentTransaction transaction=(CreateAgentTransaction)ledgerService.getTx(createTxHash);
  if (null == transaction) {
    return Result.getFailed(KernelErrorCode.DATA_NOT_FOUND).toRpcClientResult();
  }
  List<Coin> fromList=new ArrayList<>();
  for (int index=0; index < transaction.getCoinData().getTo().size(); index++) {
    Coin coin=transaction.getCoinData().getTo().get(index);
    if (coin.getLockTime() == -1L && coin.getNa().equals(agent.getDeposit())) {
      coin.setOwner(ArraysTool.concatenate(transaction.getHash().serialize(),new VarInt(index).encode()));
      fromList.add(coin);
      break;
    }
  }
  if (fromList.isEmpty()) {
    return Result.getFailed(KernelErrorCode.DATA_ERROR).toRpcClientResult();
  }
  coinData.setFrom(fromList);
  Na fee=TransactionFeeCalculator.getMaxFee(tx.size());
  coinData.getTo().get(0).setNa(coinData.getTo().get(0).getNa().subtract(fee));
  tx.setCoinData(coinData);
  Na resultFee=TransactionFeeCalculator.getMaxFee(tx.size() + P2PKHScriptSig.DEFAULT_SERIALIZE_LENGTH);
  return Result.getSuccess().setData(resultFee).toRpcClientResult();
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=String.class)}) public RpcClientResult getStopAgentFee(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @QueryParam("String_Node_Str") String address) throws NulsException, IOException {
  AssertUtil.canNotEmpty(address,"String_Node_Str");
  if (!AddressTool.validAddress(address)) {
    return Result.getFailed(KernelErrorCode.PARAMETER_ERROR).toRpcClientResult();
  }
  StopAgentTransaction tx=new StopAgentTransaction();
  StopAgent stopAgent=new StopAgent();
  stopAgent.setAddress(AddressTool.getAddress(address));
  List<Agent> agentList=PocConsensusContext.getChainManager().getMasterChain().getChain().getAgentList();
  Agent agent=null;
  for (  Agent a : agentList) {
    if (a.getDelHeight() > 0) {
      continue;
    }
    if (Arrays.equals(a.getAgentAddress(),stopAgent.getAddress())) {
      agent=a;
      break;
    }
  }
  if (agent == null || agent.getDelHeight() > 0) {
    return Result.getFailed(PocConsensusErrorCode.AGENT_NOT_EXIST).toRpcClientResult();
  }
  NulsDigestData createTxHash=agent.getTxHash();
  stopAgent.setCreateTxHash(createTxHash);
  tx.setTxData(stopAgent);
  CoinData coinData=ConsensusTool.getStopAgentCoinData(agent,PocConsensusConstant.STOP_AGENT_LOCK_TIME);
  tx.setCoinData(coinData);
  Na fee=TransactionFeeCalculator.getMaxFee(tx.size() + P2PKHScriptSig.DEFAULT_SERIALIZE_LENGTH);
  coinData.getTo().get(0).setNa(coinData.getTo().get(0).getNa().subtract(fee));
  Na resultFee=TransactionFeeCalculator.getMaxFee(tx.size() + P2PKHScriptSig.DEFAULT_SERIALIZE_LENGTH);
  return Result.getSuccess().setData(resultFee).toRpcClientResult();
}