From: Damyan Ivanov Date: Sun, 28 Feb 2021 16:55:53 +0000 (+0200) Subject: fix sending empty transaction comments as "", not as null X-Git-Tag: v0.17.0~66 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=5893f6b43cfa856588eb32df4bd2365e96e702db;p=mobile-ledger.git fix sending empty transaction comments as "", not as null null causes a '400 expecting String, found Null' --- diff --git a/app/src/main/java/net/ktnx/mobileledger/json/v1_14/ParsedLedgerTransaction.java b/app/src/main/java/net/ktnx/mobileledger/json/v1_14/ParsedLedgerTransaction.java index eec404b8..6c884159 100644 --- a/app/src/main/java/net/ktnx/mobileledger/json/v1_14/ParsedLedgerTransaction.java +++ b/app/src/main/java/net/ktnx/mobileledger/json/v1_14/ParsedLedgerTransaction.java @@ -1,5 +1,5 @@ /* - * Copyright © 2020 Damyan Ivanov. + * Copyright © 2021 Damyan Ivanov. * This file is part of MoLe. * MoLe is free software: you can distribute it and/or modify it * under the term of the GNU General Public License as published by @@ -48,7 +48,7 @@ public class ParsedLedgerTransaction implements net.ktnx.mobileledger.json.Parse public static ParsedLedgerTransaction fromLedgerTransaction(LedgerTransaction tr) { ParsedLedgerTransaction result = new ParsedLedgerTransaction(); - result.setTcomment(tr.getComment()); + result.setTcomment(Misc.nullIsEmpty(tr.getComment())); result.setTprecedingcomment(""); ArrayList postings = new ArrayList<>(); diff --git a/app/src/main/java/net/ktnx/mobileledger/json/v1_15/ParsedLedgerTransaction.java b/app/src/main/java/net/ktnx/mobileledger/json/v1_15/ParsedLedgerTransaction.java index 9a9bfdc0..bc1950ba 100644 --- a/app/src/main/java/net/ktnx/mobileledger/json/v1_15/ParsedLedgerTransaction.java +++ b/app/src/main/java/net/ktnx/mobileledger/json/v1_15/ParsedLedgerTransaction.java @@ -1,5 +1,5 @@ /* - * Copyright © 2020 Damyan Ivanov. + * Copyright © 2021 Damyan Ivanov. * This file is part of MoLe. * MoLe is free software: you can distribute it and/or modify it * under the term of the GNU General Public License as published by @@ -46,7 +46,7 @@ public class ParsedLedgerTransaction implements net.ktnx.mobileledger.json.Parse } public static ParsedLedgerTransaction fromLedgerTransaction(LedgerTransaction tr) { ParsedLedgerTransaction result = new ParsedLedgerTransaction(); - result.setTcomment(tr.getComment()); + result.setTcomment(Misc.nullIsEmpty(tr.getComment())); result.setTprecedingcomment(""); ArrayList postings = new ArrayList<>(); diff --git a/app/src/main/java/net/ktnx/mobileledger/json/v1_19_1/ParsedLedgerTransaction.java b/app/src/main/java/net/ktnx/mobileledger/json/v1_19_1/ParsedLedgerTransaction.java index 74af2339..196408c7 100644 --- a/app/src/main/java/net/ktnx/mobileledger/json/v1_19_1/ParsedLedgerTransaction.java +++ b/app/src/main/java/net/ktnx/mobileledger/json/v1_19_1/ParsedLedgerTransaction.java @@ -1,5 +1,5 @@ /* - * Copyright © 2020 Damyan Ivanov. + * Copyright © 2021 Damyan Ivanov. * This file is part of MoLe. * MoLe is free software: you can distribute it and/or modify it * under the term of the GNU General Public License as published by @@ -46,7 +46,7 @@ public class ParsedLedgerTransaction implements net.ktnx.mobileledger.json.Parse } public static ParsedLedgerTransaction fromLedgerTransaction(LedgerTransaction tr) { ParsedLedgerTransaction result = new ParsedLedgerTransaction(); - result.setTcomment(tr.getComment()); + result.setTcomment(Misc.nullIsEmpty(tr.getComment())); result.setTprecedingcomment(""); ArrayList postings = new ArrayList<>();