context.onRetrieveDone(null);
}
private String retrieveTransactionListLegacy(MobileLedgerProfile profile)
- throws IOException, ParseException {
+ throws IOException, ParseException, HTTPException {
Progress progress = new Progress();
int maxTransactionId = Progress.INDETERMINATE;
ArrayList<LedgerAccount> accountList = new ArrayList<>();
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());
+ }
try (SQLiteDatabase db = MLDB.getWritableDatabase()) {
try (InputStream resp = http.getInputStream()) {
if (http.getResponseCode() != 200)
http.setAllowUserInteraction(false);
publishProgress(progress);
switch (http.getResponseCode()) {
- case 200: break;
- case 404: return false;
- default: throw new HTTPException(http.getResponseCode(), http.getResponseMessage());
+ case 200:
+ break;
+ case 404:
+ return false;
+ default:
+ throw new HTTPException(http.getResponseCode(), http.getResponseMessage());
}
try (SQLiteDatabase db = MLDB.getWritableDatabase()) {
try (InputStream resp = http.getInputStream()) {
progress.setTotal(maxTransactionId);
}
+ if ((progress.getTotal() == Progress.INDETERMINATE) ||
+ (progress.getTotal() < transaction.getId()))
+ progress.setTotal(transaction.getId());
+
progress.setProgress(++processedTransactionCount);
publishProgress(progress);
}
}
catch (IOException e) {
e.printStackTrace();
- return "Parse error";
+ return e.getLocalizedMessage();
}
catch (ParseException e) {
e.printStackTrace();