Program: 34997
Project: 34997
Buggy source:
@Override public Result transfer(byte[] from,byte[] to,Na values,String password,String remark){
  try {
    Result<Account> accountResult=accountService.getAccount(from);
    if (accountResult.isFailed()) {
      return accountResult;
    }
    Account account=accountResult.getData();
    if (accountService.isEncrypted(account).isSuccess() && account.isLocked()) {
      AssertUtil.canNotEmpty(password,"String_Node_Str");
      Result passwordResult=accountService.validPassword(account,password);
      if (passwordResult.isFailed()) {
        return passwordResult;
      }
    }
    TransferTransaction tx=new TransferTransaction();
    try {
      tx.setRemark(remark.getBytes(NulsConfig.DEFAULT_ENCODING));
    }
 catch (    UnsupportedEncodingException e) {
      e.printStackTrace();
    }
    tx.setTime(TimeService.currentTimeMillis());
    CoinData coinData=new CoinData();
    Coin toCoin=new Coin(to,values);
    coinData.getTo().add(toCoin);
    CoinDataResult coinDataResult=getCoinData(from,values,tx.size() + P2PKHScriptSig.DEFAULT_SERIALIZE_LENGTH);
    if (!coinDataResult.isEnough()) {
      return Result.getFailed(LedgerErrorCode.BALANCE_NOT_ENOUGH);
    }
    coinData.setFrom(coinDataResult.getCoinList());
    if (coinDataResult.getChange() != null) {
      coinData.getTo().add(coinDataResult.getChange());
    }
    tx.setCoinData(coinData);
    tx.setHash(NulsDigestData.calcDigestData(tx.serializeForHash()));
    P2PKHScriptSig sig=new P2PKHScriptSig();
    sig.setPublicKey(account.getPubKey());
    sig.setSignData(accountService.signData(tx.getHash().serialize(),account,password));
    tx.setScriptSig(sig.serialize());
    Result saveResult=verifyAndSaveUnconfirmedTransaction(tx);
    if (saveResult.isFailed()) {
      return saveResult;
    }
    Result sendResult=transactionService.broadcastTx(tx);
    if (sendResult.isFailed()) {
      this.rollbackTransaction(tx);
      return sendResult;
    }
    return Result.getSuccess().setData(tx.getHash().getDigestHex());
  }
 catch (  IOException e) {
    Log.error(e);
    return Result.getFailed(e.getMessage());
  }
catch (  NulsException e) {
    Log.error(e);
    return Result.getFailed(e.getErrorCode());
  }
}

Fixed version (ground truth):
@Override public Result transfer(byte[] from,byte[] to,Na values,String password,String remark){
  try {
    Result<Account> accountResult=accountService.getAccount(from);
    if (accountResult.isFailed()) {
      return accountResult;
    }
    Account account=accountResult.getData();
    if (accountService.isEncrypted(account).isSuccess() && account.isLocked()) {
      AssertUtil.canNotEmpty(password,"String_Node_Str");
      Result passwordResult=accountService.validPassword(account,password);
      if (passwordResult.isFailed()) {
        return passwordResult;
      }
    }
    TransferTransaction tx=new TransferTransaction();
    if (StringUtils.isNotBlank(remark)) {
      try {
        tx.setRemark(remark.getBytes(NulsConfig.DEFAULT_ENCODING));
      }
 catch (      UnsupportedEncodingException e) {
        Log.error(e);
      }
    }
    tx.setTime(TimeService.currentTimeMillis());
    CoinData coinData=new CoinData();
    Coin toCoin=new Coin(to,values);
    coinData.getTo().add(toCoin);
    CoinDataResult coinDataResult=getCoinData(from,values,tx.size() + P2PKHScriptSig.DEFAULT_SERIALIZE_LENGTH);
    if (!coinDataResult.isEnough()) {
      return Result.getFailed(LedgerErrorCode.BALANCE_NOT_ENOUGH);
    }
    coinData.setFrom(coinDataResult.getCoinList());
    if (coinDataResult.getChange() != null) {
      coinData.getTo().add(coinDataResult.getChange());
    }
    tx.setCoinData(coinData);
    tx.setHash(NulsDigestData.calcDigestData(tx.serializeForHash()));
    P2PKHScriptSig sig=new P2PKHScriptSig();
    sig.setPublicKey(account.getPubKey());
    sig.setSignData(accountService.signData(tx.getHash().serialize(),account,password));
    tx.setScriptSig(sig.serialize());
    Result saveResult=verifyAndSaveUnconfirmedTransaction(tx);
    if (saveResult.isFailed()) {
      return saveResult;
    }
    Result sendResult=transactionService.broadcastTx(tx);
    if (sendResult.isFailed()) {
      this.rollbackTransaction(tx);
      return sendResult;
    }
    return Result.getSuccess().setData(tx.getHash().getDigestHex());
  }
 catch (  IOException e) {
    Log.error(e);
    return Result.getFailed(e.getMessage());
  }
catch (  NulsException e) {
    Log.error(e);
    return Result.getFailed(e.getErrorCode());
  }
}