public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void> {
private final TaskCallback taskCallback;
+ private final MobileLedgerProfile mProfile;
+ private final boolean simulate;
protected String error;
private String token;
private String session;
private LedgerTransaction transaction;
- private final MobileLedgerProfile mProfile;
- private final boolean simulate;
public SendTransactionTask(TaskCallback callback, MobileLedgerProfile profile,
boolean simulate) {
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();
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());