Program: 10933
Project: 10933
Buggy source:
public List<AddressTx> insertOut(IDb db,Tx txItem){
  String existSql="String_Node_Str";
  String updateHDAccountIdSql="String_Node_Str";
  String queryHDAddressSql="String_Node_Str";
  String updateHDAddressIssuedSql="String_Node_Str";
  String queryPrevTxHashSql="String_Node_Str";
  String updateOutStatusSql="String_Node_Str";
  final List<AddressTx> addressTxes=new ArrayList<AddressTx>();
  for (  final Out outItem : txItem.getOuts()) {
    final int[] cnt={0};
    this.execQueryOneRecord(db,existSql,new String[]{Base58.encode(outItem.getTxHash()),Integer.toString(outItem.getOutSn())},new Function<ICursor,Void>(){
      @Nullable @Override public Void apply(      @Nullable ICursor c){
        int idColumn=c.getColumnIndex("String_Node_Str");
        if (idColumn != -1) {
          cnt[0]=c.getInt(idColumn);
        }
        return null;
      }
    }
);
    if (cnt[0] == 0) {
      this.insertOutToDb(db,outItem);
    }
 else {
      if (outItem.getHDAccountId() > -1) {
      }
      if (outItem.getHDAccountId() > -1) {
        this.execUpdate(db,updateHDAccountIdSql,new String[]{Base58.encode(txItem.getTxHash()),Integer.toString(outItem.getOutSn())});
        final int[] tmpHDAccountId={-1};
        final int[] tmpPathType={0};
        final int[] tmpAddressIndex={0};
        this.execQueryOneRecord(db,queryHDAddressSql,new String[]{outItem.getOutAddress()},new Function<ICursor,Void>(){
          @Nullable @Override public Void apply(          @Nullable ICursor c){
            tmpHDAccountId[0]=c.getInt(0);
            tmpPathType[0]=c.getInt(1);
            tmpAddressIndex[0]=c.getInt(2);
            return null;
          }
        }
);
        if (tmpHDAccountId[0] > 0) {
          this.execUpdate(db,updateHDAddressIssuedSql,new String[]{"String_Node_Str",Integer.toString(tmpPathType[0]),Integer.toString(tmpAddressIndex[0]),Integer.toString(tmpHDAccountId[0])});
        }
      }
    }
    if (!Utils.isEmpty(outItem.getOutAddress())) {
      addressTxes.add(new AddressTx(outItem.getOutAddress(),Base58.encode(txItem.getTxHash())));
    }
    final boolean[] isSpentByExistTx={false};
    this.execQueryOneRecord(db,queryPrevTxHashSql,new String[]{Base58.encode(txItem.getTxHash()),Integer.toString(outItem.getOutSn())},new Function<ICursor,Void>(){
      @Nullable @Override public Void apply(      @Nullable ICursor c){
        int idColumn=c.getColumnIndex("String_Node_Str");
        if (idColumn != -1) {
          addressTxes.add(new AddressTx(outItem.getOutAddress(),c.getString(idColumn)));
        }
        isSpentByExistTx[0]=true;
        return null;
      }
    }
);
    if (isSpentByExistTx[0]) {
      this.execUpdate(db,updateOutStatusSql,new String[]{Integer.toString(Out.OutStatus.spent.getValue()),Base58.encode(txItem.getTxHash()),Integer.toString(outItem.getOutSn())});
    }
  }
  return addressTxes;
}

Fixed version (ground truth):
public List<AddressTx> insertOut(IDb db,Tx txItem){
  String existSql="String_Node_Str";
  String updateHDAccountIdSql="String_Node_Str";
  String queryHDAddressSql="String_Node_Str";
  String updateHDAddressIssuedSql="String_Node_Str";
  String queryPrevTxHashSql="String_Node_Str";
  String updateOutStatusSql="String_Node_Str";
  final List<AddressTx> addressTxes=new ArrayList<AddressTx>();
  for (  final Out outItem : txItem.getOuts()) {
    final int[] cnt={0};
    this.execQueryOneRecord(db,existSql,new String[]{Base58.encode(outItem.getTxHash()),Integer.toString(outItem.getOutSn())},new Function<ICursor,Void>(){
      @Nullable @Override public Void apply(      @Nullable ICursor c){
        int idColumn=c.getColumnIndex("String_Node_Str");
        if (idColumn != -1) {
          cnt[0]=c.getInt(idColumn);
        }
        return null;
      }
    }
);
    if (cnt[0] == 0) {
      this.insertOutToDb(db,outItem);
    }
 else {
      if (outItem.getHDAccountId() > -1) {
        this.execUpdate(db,updateHDAccountIdSql,new String[]{Integer.toString(outItem.getHDAccountId()),Base58.encode(txItem.getTxHash()),Integer.toString(outItem.getOutSn())});
        final int[] tmpHDAccountId={-1};
        final int[] tmpPathType={0};
        final int[] tmpAddressIndex={0};
        this.execQueryOneRecord(db,queryHDAddressSql,new String[]{outItem.getOutAddress()},new Function<ICursor,Void>(){
          @Nullable @Override public Void apply(          @Nullable ICursor c){
            tmpHDAccountId[0]=c.getInt(0);
            tmpPathType[0]=c.getInt(1);
            tmpAddressIndex[0]=c.getInt(2);
            return null;
          }
        }
);
        if (tmpHDAccountId[0] > 0) {
          this.execUpdate(db,updateHDAddressIssuedSql,new String[]{"String_Node_Str",Integer.toString(tmpPathType[0]),Integer.toString(tmpAddressIndex[0]),Integer.toString(tmpHDAccountId[0])});
        }
      }
    }
    if (!Utils.isEmpty(outItem.getOutAddress())) {
      addressTxes.add(new AddressTx(outItem.getOutAddress(),Base58.encode(txItem.getTxHash())));
    }
    final boolean[] isSpentByExistTx={false};
    this.execQueryOneRecord(db,queryPrevTxHashSql,new String[]{Base58.encode(txItem.getTxHash()),Integer.toString(outItem.getOutSn())},new Function<ICursor,Void>(){
      @Nullable @Override public Void apply(      @Nullable ICursor c){
        int idColumn=c.getColumnIndex("String_Node_Str");
        if (idColumn != -1) {
          addressTxes.add(new AddressTx(outItem.getOutAddress(),c.getString(idColumn)));
        }
        isSpentByExistTx[0]=true;
        return null;
      }
    }
);
    if (isSpentByExistTx[0]) {
      this.execUpdate(db,updateOutStatusSql,new String[]{Integer.toString(Out.OutStatus.spent.getValue()),Base58.encode(txItem.getTxHash()),Integer.toString(outItem.getOutSn())});
    }
  }
  return addressTxes;
}