fluttercommunity/flutter_downloader

Nullpointer exception on httpconn.contentType in DownloadWorker.kt if contentType is not provided by the server.

8Duke8 opened this issue · 6 comments

D/DownloadWorker( 7364): Update notification: {notificationId: 5, title: offlineMapCZ.map, status: FAILED, progress: -1}
W/System.err( 7364): java.lang.NullPointerException: httpConn.contentType must not be null
W/System.err( 7364): at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.kt:343)
W/System.err( 7364): at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.kt:206)
W/System.err( 7364): at androidx.work.Worker$1.run(Worker.java:86)
W/System.err( 7364): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
W/System.err( 7364): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
W/System.err( 7364): at java.lang.Thread.run(Thread.java:1012)

The contentType should be handled as optional if possible.

I use the latest version 1.11.6.

Any luck ? i am facing the same issue ?? @8Duke8

I have the same problem, version 1.11.7, Android 10
D/DownloadWorker(19750): Update notification: {notificationId: 36, title: -----image url-----, status: FAILED, progress: -1} W/System.err(19750): java.lang.NullPointerException W/System.err(19750): at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.kt:389) W/System.err(19750): at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.kt:206) W/System.err(19750): at androidx.work.Worker$1.run(Worker.java:86) W/System.err(19750): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) W/System.err(19750): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) W/System.err(19750): at java.lang.Thread.run(Thread.java:919) I/WM-WorkerWrapper(19750): Worker result FAILURE for Work [ id=51508954-9a1d-4ead-88ae-d1827c66d0d4, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]

I have the same issue, does anyone have an idea how to fix?

I checked again, the situation is like this:
When downloading a new file, there are no errors.
And when downloading again.
But if you delete all downloaded files, downloading again results in an error.
If you always give files unique names when downloading, then there will be no errors even after deleting all the files.

I have the same issue, does anybody know how to fix this?