]> git.ktnx.net Git - mobile-ledger-staging.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/SendTransactionTask.java
include errors sending transaction in debug output
[mobile-ledger-staging.git] / app / src / main / java / net / ktnx / mobileledger / async / SendTransactionTask.java
index 9754a84e008f419430a1b35cafdeffbe6b5181c2..8720dc0d5fb747b75494dde69941b849a104c7f9 100644 (file)
@@ -147,8 +147,19 @@ public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void
                     case 201:
                         break;
                     case 400:
-                    case 405:
+                    case 405: {
+                        BufferedReader reader = new BufferedReader(new InputStreamReader(resp));
+                        String line;
+                        int count = 0;
+                        while (count <= 5) {
+                            line = reader.readLine();
+                            if (line == null)
+                                break;
+                            Logger.debug("network", line);
+                            count++;
+                        }
                         return false; // will cause a retry with the legacy method
+                    }
                     default:
                         BufferedReader reader = new BufferedReader(new InputStreamReader(resp));
                         String line = reader.readLine();
@@ -177,7 +188,9 @@ public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void
         if (token != null)
             params.addPair("_token", token);
 
-        SimpleDate transactionDate = transaction.getDate();
+        SimpleDate transactionDate = transaction.getDateIfAny();
+        if (transactionDate == null)
+            transactionDate = SimpleDate.today();
 
         params.addPair("date", Globals.formatLedgerDate(transactionDate));
         params.addPair("description", transaction.getDescription());