]> git.ktnx.net Git - mobile-ledger.git/commitdiff
short-skip lines starting with space when parsing
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 16 Dec 2018 06:31:34 +0000 (06:31 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 16 Dec 2018 06:31:34 +0000 (06:31 +0000)
app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java

index 60827d2130e0e6484feee8d32f529a5fca849e35..1ef1ccade00e4d40cf93f266b6c3a1205b9e36a1 100644 (file)
@@ -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);