Program: 34967
Project: 34967
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 getWithdrawFee(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @QueryParam("String_Node_Str") String address,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @QueryParam("String_Node_Str") String depositTxHash) throws NulsException, IOException {
  AssertUtil.canNotEmpty(depositTxHash);
  if (!NulsDigestData.validHash(depositTxHash)) {
    return Result.getFailed(KernelErrorCode.PARAMETER_ERROR).toRpcClientResult();
  }
  AssertUtil.canNotEmpty(address);
  if (!AddressTool.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR).toRpcClientResult();
  }
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST).toRpcClientResult();
  }
  CancelDepositTransaction tx=new CancelDepositTransaction();
  CancelDeposit cancelDeposit=new CancelDeposit();
  NulsDigestData hash=NulsDigestData.fromDigestHex(depositTxHash);
  DepositTransaction depositTransaction=(DepositTransaction)ledgerService.getTx(hash);
  if (null == depositTransaction) {
    return Result.getFailed(KernelErrorCode.DATA_NOT_FOUND).toRpcClientResult();
  }
  cancelDeposit.setAddress(AddressTool.getAddress(depositTxHash));
  cancelDeposit.setJoinTxHash(hash);
  tx.setTxData(cancelDeposit);
  CoinData coinData=new CoinData();
  List<Coin> toList=new ArrayList<>();
  toList.add(new Coin(cancelDeposit.getAddress(),depositTransaction.getTxData().getDeposit(),0));
  coinData.setTo(toList);
  List<Coin> fromList=new ArrayList<>();
  for (int index=0; index < depositTransaction.getCoinData().getTo().size(); index++) {
    Coin coin=depositTransaction.getCoinData().getTo().get(index);
    if (coin.getLockTime() == -1L && coin.getNa().equals(depositTransaction.getTxData().getDeposit())) {
      coin.setOwner(ArraysTool.concatenate(hash.serialize(),new VarInt(index).encode()));
      fromList.add(coin);
      break;
    }
  }
  if (fromList.isEmpty()) {
    return Result.getFailed(KernelErrorCode.DATA_ERROR).toRpcClientResult();
  }
  coinData.setFrom(fromList);
  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();
}

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 getWithdrawFee(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @QueryParam("String_Node_Str") String address,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @QueryParam("String_Node_Str") String depositTxHash) throws NulsException, IOException {
  AssertUtil.canNotEmpty(depositTxHash);
  if (!NulsDigestData.validHash(depositTxHash)) {
    return Result.getFailed(KernelErrorCode.PARAMETER_ERROR).toRpcClientResult();
  }
  AssertUtil.canNotEmpty(address);
  if (!AddressTool.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR).toRpcClientResult();
  }
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST).toRpcClientResult();
  }
  CancelDepositTransaction tx=new CancelDepositTransaction();
  CancelDeposit cancelDeposit=new CancelDeposit();
  NulsDigestData hash=NulsDigestData.fromDigestHex(depositTxHash);
  DepositTransaction depositTransaction=(DepositTransaction)ledgerService.getTx(hash);
  if (null == depositTransaction) {
    return Result.getFailed(KernelErrorCode.DATA_NOT_FOUND).toRpcClientResult();
  }
  cancelDeposit.setAddress(account.getAddress().getAddressBytes());
  cancelDeposit.setJoinTxHash(hash);
  tx.setTxData(cancelDeposit);
  CoinData coinData=new CoinData();
  List<Coin> toList=new ArrayList<>();
  toList.add(new Coin(cancelDeposit.getAddress(),depositTransaction.getTxData().getDeposit(),0));
  coinData.setTo(toList);
  List<Coin> fromList=new ArrayList<>();
  for (int index=0; index < depositTransaction.getCoinData().getTo().size(); index++) {
    Coin coin=depositTransaction.getCoinData().getTo().get(index);
    if (coin.getLockTime() == -1L && coin.getNa().equals(depositTransaction.getTxData().getDeposit())) {
      coin.setOwner(ArraysTool.concatenate(hash.serialize(),new VarInt(index).encode()));
      fromList.add(coin);
      break;
    }
  }
  if (fromList.isEmpty()) {
    return Result.getFailed(KernelErrorCode.DATA_ERROR).toRpcClientResult();
  }
  coinData.setFrom(fromList);
  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();
}