]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java
if(!isCancelled) → throwIfCancelled()
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / RetrieveTransactionsTask.java
index f0a7e0e6f0152b3f2c2291b4dd10bda8d79959ac..601e7eca3c5740cedc1bd4e9100de9c83b326bdc 100644 (file)
@@ -45,7 +45,6 @@ import java.net.MalformedURLException;
 import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -109,7 +108,7 @@ public class RetrieveTransactionsTask extends
         Progress progress = new Progress();
         int maxTransactionId = Progress.INDETERMINATE;
         success = false;
-        List<LedgerAccount> accountList = new ArrayList<>();
+        ArrayList<LedgerAccount> accountList = new ArrayList<>();
         LedgerAccount lastAccount = null;
         Data.backgroundTaskCount.incrementAndGet();
         try {
@@ -303,10 +302,11 @@ public class RetrieveTransactionsTask extends
                                             String.format("Unknown parser updating %s", state.name()));
                             }
                         }
-                        if (!isCancelled()) {
-                            db.execSQL("DELETE FROM transactions WHERE keep = 0");
-                            db.setTransactionSuccessful();
-                        }
+
+                        throwIfCancelled();
+
+                        db.execSQL("DELETE FROM transactions WHERE keep = 0");
+                        db.setTransactionSuccessful();
                     }
                     finally {
                         db.endTransaction();