RuntimeException when downloading OpenCellID data with incorrect API key
Created by: zaventh
- Install the app
- Enter an incorrect OCID API key (i.e. typo)
- Press "Download BTS Data" from the navigation drawer
- The app and service crash.
The OCID server returns an 401 HTTP response code, and the app enters an error condition block that displays a Toast. However, a Toast cannot be displayed here because it is not currently executing on the main thread.
Occurs on tag v0.1.34-alpha-b00 (8dd3f7ff) as well as latest development commit (a4b5bd4e).
relevant log:
09-25 19:09:37.871 20266-20266/com.SecUpwN.AIMSICD I/AIMSICDDbAdapter: Checking for db first install this will throw an error on install and is noraml
09-25 19:09:37.881 20266-20266/com.SecUpwN.AIMSICD D/AIMSICD: AppAIMSICD: BaseTask addTask activity:com.SecUpwN.AIMSICD.AIMSICD
09-25 19:09:37.881 20266-20266/com.SecUpwN.AIMSICD V/AIMSICD: AppAIMSICD: BaseTask added:com.SecUpwN.AIMSICD.utils.RequestTask@33f4076b
09-25 19:09:37.886 20266-20599/com.SecUpwN.AIMSICD I/RequestTask: DBE_DOWNLOAD_REQUEST write to: /storage/emulated/0/Android/data/com.SecUpwN.AIMSICD/files/OpenCellID/opencellid.csv
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: Process: com.SecUpwN.AIMSICD, PID: 20266
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: java.lang.RuntimeException: An error occured while executing doInBackground()
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at android.os.AsyncTask$3.done(AsyncTask.java:304)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:242)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at android.os.Handler.<init>(Handler.java:200)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at android.os.Handler.<init>(Handler.java:114)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at android.widget.Toast$TN.<init>(Toast.java:346)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at android.widget.Toast.<init>(Toast.java:102)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at android.widget.Toast.makeText(Toast.java:260)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at com.SecUpwN.AIMSICD.utils.Toaster.msgLong(Toaster.java:51)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at com.SecUpwN.AIMSICD.utils.Helpers.msgLong(Helpers.java:94)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at com.SecUpwN.AIMSICD.utils.RequestTask.doInBackground(RequestTask.java:226)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at com.SecUpwN.AIMSICD.utils.RequestTask.doInBackground(RequestTask.java:96)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at android.os.AsyncTask$2.call(AsyncTask.java:292)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
09-25 19:09:38.225 20266-20599/com.SecUpwN.AIMSICD E/AndroidRuntime: at java.lang.Thread.run(Thread.java:818)