[AC-795] TiDownloadManager crashes with links returning redirects (302)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-06-29T17:12:36.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | TCSupportTriage |
Reporter | Matteo Landi |
Assignee | Radamantis Torres-Lechuga |
Created | 2014-12-29T15:22:51.000+0000 |
Updated | 2016-03-08T07:37:04.000+0000 |
Description
TiDownloadManager doesn't seem to properly handle redirects on Android Lollipop. This is the exception I get:
ERROR] TiDownloadManager: (pool-4-thread-1) [916,916] Exception downloading https://graph.facebook.com/100008778152788/picture?width=200&height=200
[ERROR] TiDownloadManager: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference
[ERROR] TiDownloadManager: at com.android.okhttp.internal.http.StatusLine.<init>(StatusLine.java:24)
[ERROR] TiDownloadManager: at com.android.okhttp.Response$Builder.statusLine(Response.java:419)
[ERROR] TiDownloadManager: at com.android.okhttp.internal.http.JavaApiConverter.createOkResponse(JavaApiConverter.java:116)
[ERROR] TiDownloadManager: at com.android.okhttp.internal.http.ResponseCacheAdapter.get(ResponseCacheAdapter.java:53)
[ERROR] TiDownloadManager: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:190)
[ERROR] TiDownloadManager: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
[ERROR] TiDownloadManager: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
[ERROR] TiDownloadManager: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:190)
[ERROR] TiDownloadManager: at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
[ERROR] TiDownloadManager: at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
[ERROR] TiDownloadManager: at java.net.URL.openStream(URL.java:470)
[ERROR] TiDownloadManager: at org.appcelerator.titanium.util.TiDownloadManager$DownloadJob.run(TiDownloadManager.java:135)
[ERROR] TiDownloadManager: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
[ERROR] TiDownloadManager: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
[ERROR] TiDownloadManager: at java.lang.Thread.run(Thread.java:818)
Attached you can find a single window application in which two image views are used to display remote images. The second of the two uses some facebook redirect to get the actual image url, and TiDownloadManager crashes while fetching the data.
Attachments
File | Date | Size |
---|---|---|
redirect.tgz | 2014-12-29T15:22:51.000+0000 | 4085569 |
To work around this, call setUseCaches(false) on the URL connection before opening the stream, but I don't know why this happens.
This is caused by a bug in TiCacheResponse. I reported this in a separate issue - TC-5388 Also see: http://stackoverflow.com/a/29147399/2603965
Any update for this issue? Or do we have to implement our own image cache?
This is the same as item TC-5388 which has just been fixed for 4.0.1