From: Faye Duxovni Date: Thu, 9 Jun 2022 06:11:09 +0000 (-0400) Subject: Set valid default value for tsourcepos in v1.23 ParsedLedgerTransaction X-Git-Tag: v0.21.4~3 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=71d045d69f68cc66b63b29d371a5c98f9363066a;p=mobile-ledger.git Set valid default value for tsourcepos in v1.23 ParsedLedgerTransaction If tsourcepos is an empty list, attempting to add a transaction will be rejected by the server, which is expecting a pair of values. This sets it to a well-formed default value which the server will accept. --- diff --git a/app/src/main/java/net/ktnx/mobileledger/json/v1_23/ParsedLedgerTransaction.java b/app/src/main/java/net/ktnx/mobileledger/json/v1_23/ParsedLedgerTransaction.java index fe0a2809..59d17635 100644 --- a/app/src/main/java/net/ktnx/mobileledger/json/v1_23/ParsedLedgerTransaction.java +++ b/app/src/main/java/net/ktnx/mobileledger/json/v1_23/ParsedLedgerTransaction.java @@ -43,6 +43,12 @@ public class ParsedLedgerTransaction implements net.ktnx.mobileledger.json.Parse private List> ttags = new ArrayList<>(); private List tsourcepos = new ArrayList<>(); public ParsedLedgerTransaction() { + ParsedSourcePos startPos = new ParsedSourcePos(); + ParsedSourcePos endPos = new ParsedSourcePos(); + endPos.setSourceLine(2); + + tsourcepos.add(startPos); + tsourcepos.add(endPos); } public static ParsedLedgerTransaction fromLedgerTransaction(LedgerTransaction tr) { ParsedLedgerTransaction result = new ParsedLedgerTransaction(); diff --git a/app/src/main/java/net/ktnx/mobileledger/json/v1_23/ParsedSourcePos.java b/app/src/main/java/net/ktnx/mobileledger/json/v1_23/ParsedSourcePos.java index 6a62f8dd..b3ea5db6 100644 --- a/app/src/main/java/net/ktnx/mobileledger/json/v1_23/ParsedSourcePos.java +++ b/app/src/main/java/net/ktnx/mobileledger/json/v1_23/ParsedSourcePos.java @@ -18,9 +18,9 @@ package net.ktnx.mobileledger.json.v1_23; class ParsedSourcePos { - private String sourceName; - private int sourceLine; - private int sourceColumn; + private String sourceName = ""; + private int sourceLine = 1; + private int sourceColumn = 1; public ParsedSourcePos() { } public String getSourceName() {