{"record":{"id":"a9c13aecf72f718f","repo":"lingochamp/FileDownloader","slug":"helper-must-not-be-null","errorCode":null,"errorMessage":"helper must not be null!","messagePattern":"helper must not be null!","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"library/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationListener.java","lineNumber":34,"sourceCode":"\npackage com.liulishuo.filedownloader.notification;\n\nimport com.liulishuo.filedownloader.BaseDownloadTask;\nimport com.liulishuo.filedownloader.FileDownloadList;\nimport com.liulishuo.filedownloader.FileDownloadListener;\n\n/**\n * The listener of the notification with the task.\n *\n * @see FileDownloadNotificationHelper\n * @see BaseNotificationItem\n */\n@SuppressWarnings({\"WeakerAccess\", \"UnusedParameters\"})\npublic abstract class FileDownloadNotificationListener extends FileDownloadListener {\n    private final FileDownloadNotificationHelper helper;\n\n    public FileDownloadNotificationListener(FileDownloadNotificationHelper helper) {\n        if (helper == null) throw new IllegalArgumentException(\"helper must not be null!\");\n        this.helper = helper;\n    }\n\n    public FileDownloadNotificationHelper getHelper() {\n        return helper;\n    }\n\n\n    public void addNotificationItem(int downloadId) {\n        if (downloadId == 0) {\n            return;\n        }\n\n        BaseDownloadTask.IRunningTask task = FileDownloadList.getImpl().get(downloadId);\n        if (task != null) {\n            addNotificationItem(task.getOrigin());\n        }\n    }","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/lingochamp/FileDownloader/blob/6237a8cac174bcc916e4342b14ab1ab72a5768d4/library/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationListener.java#L16-L52","documentation":"Constructor guard in FileDownloadNotificationListener: the listener delegates all notification management (registering and updating notification items per task id) to FileDownloadNotificationHelper, so constructing the listener without a helper would break every later callback; the null check fails fast with this error. The faulty input is the helper argument passed to the constructor.","triggerScenarios":"Thrown at library/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationListener.java:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create and pass a FileDownloadNotificationHelper instance: new FileDownloadNotificationListener(context, new FileDownloadNotificationHelper()) style setup","Share one helper across all listeners of the same process so notification ids stay consistent","If you don't need notifications, extend FileDownloadListener directly instead of FileDownloadNotificationListener"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6237a8cac174bcc916e4342b14ab1ab72a5768d4","analyzedAt":"2026-09-08T23:50:48.168Z","contentChangedAt":"2026-09-08T23:50:48.168Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}