yigit / android-priority-jobqueue

A Job Queue specifically written for Android to easily schedule jobs (tasks) that run in the background, improving UX and application stability.
3.4k stars 395 forks source link

Setting of Context and Dependency Injections not being done for persistent job before cancellation. #416

Open kalpeshp0310 opened 7 years ago

kalpeshp0310 commented 7 years ago

When you cancel a persistent job, and if you use context or your injected fields in job in onCancel method. you get a NullPointerException as setting context and dependency injection are not done on cancelling persistent job. This bug gets unnoticed as exception in cancellation of job is ignored. Ref: https://github.com/yigit/android-priority-jobqueue/blob/2f4079c24381c3c8c55f4d179194a59f6b9b55d0/jobqueue/src/main/java/com/birbit/android/jobqueue/CancelHandler.java#L60 https://github.com/yigit/android-priority-jobqueue/blob/2f4079c24381c3c8c55f4d179194a59f6b9b55d0/jobqueue/src/main/java/com/birbit/android/jobqueue/JobManagerThread.java#L523