Program: 35026
Project: 35026
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 exitConsensus(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) WithdrawForm form) throws NulsException, IOException {
  AssertUtil.canNotEmpty(form);
  AssertUtil.canNotEmpty(form.getTxHash());
  AssertUtil.canNotEmpty(form.getAddress());
  if (!Address.validAddress(form.getAddress())) {
    return Result.getFailed(AccountErrorCode.ADDRESS_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);
    }
  }
  CancelDepositTransaction tx=new CancelDepositTransaction();
  CancelDeposit cancelDeposit=new CancelDeposit();
  NulsDigestData hash=NulsDigestData.fromDigestHex(form.getTxHash());
  DepositTransaction depositTransaction=(DepositTransaction)ledgerService.getTx(hash);
  if (null == depositTransaction) {
    return Result.getFailed("String_Node_Str");
  }
  cancelDeposit.setAddress(AddressTool.getAddress(form.getAddress()));
  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.joinintTogether(hash.serialize(),new VarInt(index).encode()));
      fromList.add(coin);
      break;
    }
  }
  if (fromList.isEmpty()) {
    return Result.getFailed(KernelErrorCode.DATA_ERROR);
  }
  coinData.setFrom(fromList);
  tx.setCoinData(coinData);
  Result result1=this.txProcessing(tx,null,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 exitConsensus(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) WithdrawForm form) throws NulsException, IOException {
  AssertUtil.canNotEmpty(form);
  AssertUtil.canNotEmpty(form.getTxHash());
  AssertUtil.canNotEmpty(form.getAddress());
  if (!Address.validAddress(form.getAddress())) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  Account account=accountService.getAccount(form.getAddress()).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  if (account.isEncrypted() && account.isLocked()) {
    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);
    }
  }
  CancelDepositTransaction tx=new CancelDepositTransaction();
  CancelDeposit cancelDeposit=new CancelDeposit();
  NulsDigestData hash=NulsDigestData.fromDigestHex(form.getTxHash());
  DepositTransaction depositTransaction=(DepositTransaction)ledgerService.getTx(hash);
  if (null == depositTransaction) {
    return Result.getFailed("String_Node_Str");
  }
  cancelDeposit.setAddress(AddressTool.getAddress(form.getAddress()));
  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.joinintTogether(hash.serialize(),new VarInt(index).encode()));
      fromList.add(coin);
      break;
    }
  }
  if (fromList.isEmpty()) {
    return Result.getFailed(KernelErrorCode.DATA_ERROR);
  }
  coinData.setFrom(fromList);
  tx.setCoinData(coinData);
  Result result1=this.txProcessing(tx,null,account,form.getPassword());
  if (result1.isFailed()) {
    return result1;
  }
  return Result.getSuccess().setData(tx.getHash().getDigestHex());
}