From 5893f6b43cfa856588eb32df4bd2365e96e702db Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 28 Feb 2021 18:55:53 +0200 Subject: [PATCH] fix sending empty transaction comments as "", not as null null causes a '400 expecting String, found Null' --- .../ktnx/mobileledger/json/v1_14/ParsedLedgerTransaction.java | 4 ++-- .../ktnx/mobileledger/json/v1_15/ParsedLedgerTransaction.java | 4 ++-- .../mobileledger/json/v1_19_1/ParsedLedgerTransaction.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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<>(); -- 2.39.5