lingochamp/FileDownloader · error · IllegalArgumentException

helper must not be null!

Error message

helper must not be null!

What it means

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.

Solutions

  1. Create and pass a FileDownloadNotificationHelper instance: new FileDownloadNotificationListener(context, new FileDownloadNotificationHelper()) style setup
  2. Share one helper across all listeners of the same process so notification ids stay consistent
  3. If you don't need notifications, extend FileDownloadListener directly instead of FileDownloadNotificationListener
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at library/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationListener.java:34 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of lingochamp/FileDownloader@6237a8cac1 (2026-09-08). Data as JSON: /api/errors/a9c13aecf72f718f. Report an issue: GitHub.

Appendix: source

Thrown at library/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationListener.java:34

package com.liulishuo.filedownloader.notification;

import com.liulishuo.filedownloader.BaseDownloadTask;
import com.liulishuo.filedownloader.FileDownloadList;
import com.liulishuo.filedownloader.FileDownloadListener;

/**
 * The listener of the notification with the task.
 *
 * @see FileDownloadNotificationHelper
 * @see BaseNotificationItem
 */
@SuppressWarnings({"WeakerAccess", "UnusedParameters"})
public abstract class FileDownloadNotificationListener extends FileDownloadListener {
    private final FileDownloadNotificationHelper helper;

    public FileDownloadNotificationListener(FileDownloadNotificationHelper helper) {
        if (helper == null) throw new IllegalArgumentException("helper must not be null!");
        this.helper = helper;
    }

    public FileDownloadNotificationHelper getHelper() {
        return helper;
    }


    public void addNotificationItem(int downloadId) {
        if (downloadId == 0) {
            return;
        }

        BaseDownloadTask.IRunningTask task = FileDownloadList.getImpl().get(downloadId);
        if (task != null) {
            addNotificationItem(task.getOrigin());
        }
    }

View on GitHub (pinned to 6237a8cac1)