From 9afaa87d47292f5351f8ae447a9d3ae557147472 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 16 Dec 2018 06:31:34 +0000 Subject: [PATCH] short-skip lines starting with space when parsing --- .../mobileledger/async/RetrieveTransactionsTask.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java index 60827d21..1ef1ccad 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java @@ -114,6 +114,7 @@ public class RetrieveTransactionsTask extends LedgerTransaction transaction = null; LINES: while ((line = buf.readLine()) != null) { + if (!line.isEmpty() && (line.charAt(0) == ' ')) continue; Matcher m; L(String.format("State is %d", state)); switch (state) { @@ -167,6 +168,14 @@ public class RetrieveTransactionsTask extends state = ParserState.EXPECTING_TRANSACTION; L(String.format("transaction %s saved → expecting " + "transaction", transaction.getId())); + +// sounds like a good idea, but transaction-1 may not be the first one chronologically +// for example, when you add the initial seeding transaction after entering some others +// if (transactionId == 1) { +// L("This was the initial transaction. Terminating " + +// "parser"); +// break LINES; +// } } else { m = transactionDetailsPattern.matcher(line); -- 2.39.5