Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException(DownloadWorker.kt:395) #968

Open
slavomirhay opened this issue Aug 1, 2024 · 2 comments
Open

java.lang.NullPointerException(DownloadWorker.kt:395) #968

slavomirhay opened this issue Aug 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@slavomirhay
Copy link

Throws when file already exists after enqueue and there was no task for it before. Maybe do something like showDialog AlertDialog or verify file already downloaded or continue downloading if it was only partially downloaded. I can do it but choose an option.

(DownloadWorker.kt:394) val file = createFileInAppSpecificDir(actualFilename!!, savedDir)
(DownloadWorker.kt:395) savedFilePath = file!!.path

I/NotificationManager(32113): com.my.stuff.app: notify(31, null, Notification(channel=FLUTTER_DOWNLOADER_NOTIFICATION shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x18 color=0x00000000 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)) as user
W/System.err(32113): java.lang.NullPointerException
W/System.err(32113): at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.kt:395)
W/System.err(32113): at vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.kt:206)
W/System.err(32113): at androidx.work.Worker$1.run(Worker.java:82)
W/System.err(32113): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
W/System.err(32113): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
W/System.err(32113): at java.lang.Thread.run(Thread.java:1012)
I/WM-WorkerWrapper(32113): Worker result FAILURE for Work [ id=0d66443b-2b46-4c57-be0c-7405e12bf1ac, tags={ vn.hunghd.flutterdownloader.DownloadWorker, flutter_download_task } ]
D/ConnectivityManager(32113): StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:5076)] [androidx.work.impl.utils.NetworkApi21.unregisterNetworkCallbackCompat(NetworkApi21.kt:31)] [androidx.work.impl.constraints.trackers.NetworkStateTracker24.stopTracking(NetworkStateTracker.kt:153)] [androidx.work.impl.constraints.trackers.ConstraintTracker.removeListener(ConstraintTracker.kt:72)] [androidx.work.impl.constraints.controllers.ConstraintController$track$1$1.invoke(ContraintControllers.kt:56)] [androidx.work.impl.constraints.controllers.ConstraintController$track$1$1.invoke(ContraintControllers.kt:55)] [kotlinx.coroutines.channels.ProduceKt.awaitClose(Produce.kt:54)] [kotlinx.coroutines.channels.ProduceKt$awaitClose$1.invokeSuspend(Unknown Source:13)] [kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)] [kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)] [androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)] [java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)] [java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)] [java.lang.Thread.run(Thread.java:1012)]

@slavomirhay slavomirhay added the bug Something isn't working label Aug 1, 2024
@jadroid92
Copy link

Any update ?

java.lang.NullPointerException
vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.kt:395)
vn.hunghd.flutterdownloader.DownloadWorker.doWork(DownloadWorker.kt:206)
androidx.work.Worker$1.run(Worker.java:86)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
java.lang.Thread.run(Thread.java:1012)
Worker result FAILURE for Work [ id=27b8335d-b42d-4736-a76d-2c496b9f131c, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]

@SteelTitan247
Copy link

I faced the same issue, I had to modify those functions and insert them in try/catch to not break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants