HttpURLConnection http = NetworkUtil.prepareConnection(profile, "journal");
http.setAllowUserInteraction(false);
publishProgress(progress);
- switch (http.getResponseCode()) {
- case 200:
- break;
- default:
- throw new HTTPException(http.getResponseCode(), http.getResponseMessage());
- }
+ if (http.getResponseCode() != 200)
+ throw new HTTPException(http.getResponseCode(), http.getResponseMessage());
SQLiteDatabase db = App.getDatabase();
try (InputStream resp = http.getInputStream()) {
// state of the database
db.setTransactionSuccessful();
db.endTransaction();
- Data.accounts.setList(accountList);
+ profile.setAccounts(accountList);
db.beginTransaction();
continue;
}
profile.deleteNotPresentAccounts(db);
throwIfCancelled();
db.setTransactionSuccessful();
- listFilledOK = true;
}
finally {
db.endTransaction();
}
}
- // should not be set in the DB transaction, because of a possible deadlock
- // with the main and DbOpQueueRunner threads
- if (listFilledOK)
- Data.accounts.setList(accountList);
+
+ profile.setAccounts(accountList);
return true;
}