Program: 35028
Project: 35028
Buggy source:
@POST @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 Result depositToAgent(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) DepositForm form) throws NulsException {
  AssertUtil.canNotEmpty(form);
  AssertUtil.canNotEmpty(form.getAddress());
  AssertUtil.canNotEmpty(form.getAgentHash());
  AssertUtil.canNotEmpty(form.getDeposit());
  if (!AddressTool.validAddress(form.getAddress())) {
    throw new NulsRuntimeException(KernelErrorCode.PARAMETER_ERROR);
  }
  Account account=accountService.getAccount(form.getAddress()).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  if (account.isEncrypted()) {
    AssertUtil.canNotEmpty(form.getPassword());
  }
  DepositTransaction tx=new DepositTransaction();
  Deposit deposit=new Deposit();
  deposit.setAddress(AddressTool.getAddress(form.getAddress()));
  deposit.setAgentHash(NulsDigestData.fromDigestHex(form.getAgentHash()));
  deposit.setDeposit(Na.valueOf(form.getDeposit()));
  tx.setTxData(deposit);
  CoinData coinData=new CoinData();
  List<Coin> toList=new ArrayList<>();
  toList.add(new Coin(deposit.getAddress(),deposit.getDeposit(),-1));
  coinData.setTo(toList);
  tx.setCoinData(coinData);
  CoinDataResult result=accountLedgerService.getCoinData(deposit.getAddress(),deposit.getDeposit(),tx.size() + P2PKHScriptSig.DEFAULT_SERIALIZE_LENGTH);
  Result result1=this.txProcessing(tx,result,account,form.getPassword());
  if (result1.isFailed()) {
    return result1;
  }
  return Result.getSuccess().setData(tx.getHash().getDigestHex());
}

Fixed version (ground truth):
@POST @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 Result depositToAgent(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) DepositForm form) throws NulsException {
  AssertUtil.canNotEmpty(form);
  AssertUtil.canNotEmpty(form.getAddress());
  AssertUtil.canNotEmpty(form.getAgentHash());
  AssertUtil.canNotEmpty(form.getDeposit());
  if (!AddressTool.validAddress(form.getAddress())) {
    throw new NulsRuntimeException(KernelErrorCode.PARAMETER_ERROR);
  }
  Account account=accountService.getAccount(form.getAddress()).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  if (account.isEncrypted()) {
    AssertUtil.canNotEmpty(form.getPassword());
    try {
      if (!account.decrypt(form.getPassword())) {
        return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
      }
    }
 catch (    NulsException e) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
  }
  DepositTransaction tx=new DepositTransaction();
  Deposit deposit=new Deposit();
  deposit.setAddress(AddressTool.getAddress(form.getAddress()));
  deposit.setAgentHash(NulsDigestData.fromDigestHex(form.getAgentHash()));
  deposit.setDeposit(Na.valueOf(form.getDeposit()));
  tx.setTxData(deposit);
  CoinData coinData=new CoinData();
  List<Coin> toList=new ArrayList<>();
  toList.add(new Coin(deposit.getAddress(),deposit.getDeposit(),-1));
  coinData.setTo(toList);
  tx.setCoinData(coinData);
  CoinDataResult result=accountLedgerService.getCoinData(deposit.getAddress(),deposit.getDeposit(),tx.size() + P2PKHScriptSig.DEFAULT_SERIALIZE_LENGTH);
  Result result1=this.txProcessing(tx,result,account,form.getPassword());
  if (result1.isFailed()) {
    return result1;
  }
  return Result.getSuccess().setData(tx.getHash().getDigestHex());
}