lingochamp/FileDownloader · error · IllegalArgumentException
create FileDownloadQueueSet must with valid target!
Error message
create FileDownloadQueueSet must with valid target!
What it means
FileDownloadQueueSet's constructor throws IllegalArgumentException when the target FileDownloadListener is null, since the queue set applies this single listener to every task in the set; a null listener would make the queue unusable.
Solutions
- Pass a non-null FileDownloadListener instance (often an anonymous subclass) to the constructor.
- If you don't need callbacks, pass a no-op listener instead of null.
Example fix
// before
FileDownloadQueueSet set = new FileDownloadQueueSet(null);
// after
FileDownloadQueueSet set = new FileDownloadQueueSet(new FileDownloadListener() {
@Override protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {}
@Override protected void progress(BaseDownloadTask task, int soFarBytes, int totalBytes) {}
@Override protected void completed(BaseDownloadTask task) {}
@Override protected void paused(BaseDownloadTask task, int soFarBytes, int totalBytes) {}
@Override protected void error(BaseDownloadTask task, Throwable e) {}
@Override protected void warn(BaseDownloadTask task) {}
}); Defensive patterns
Strategy: validation
Validate before calling
if (listener == null) throw new IllegalArgumentException("queue set target required");
FileDownloadQueueSet set = new FileDownloadQueueSet(listener); Type guard
boolean validTarget(FileDownloadListener l) { return l != null; } Prevention
- Assert listener non-null before constructing queue sets.
- Use a shared no-op listener when callbacks are unneeded.
- Initialize listener fields eagerly, not lazily.
When it happens
Trigger: new FileDownloadQueueSet(null).
Common situations: Dynamically resolving the listener variable that ends up null; refactoring that removed the anonymous listener.
Related errors
- the provided context must not be null!
- listener must not be null!
- event must not be null!
- can't generate real path, the file name is null
- can't generate real path, the directory is null
AI-assisted analysis of lingochamp/FileDownloader@6237a8cac1 (2026-09-08).
Data as JSON: /api/errors/773c4e5ee32d450d.
Report an issue: GitHub.
Appendix: source
Thrown at library/src/main/java/com/liulishuo/filedownloader/FileDownloadQueueSet.java:51
private List<BaseDownloadTask.FinishListener> taskFinishListenerList;
private Integer autoRetryTimes;
private Boolean syncCallback;
private Boolean isForceReDownload;
private Boolean isWifiRequired;
private Integer callbackProgressTimes;
private Integer callbackProgressMinIntervalMillis;
private Object tag;
private String directory;
private BaseDownloadTask[] tasks;
/**
* @param target The download listener will be set to all tasks in this queue set.
*/
public FileDownloadQueueSet(FileDownloadListener target) {
if (target == null) {
throw new IllegalArgumentException(
"create FileDownloadQueueSet must with valid target!");
}
this.target = target;
}
/**
* Form a queue with same {@link #target} and will {@link #start()} in parallel.
*/
public FileDownloadQueueSet downloadTogether(BaseDownloadTask... tasks) {
this.isSerial = false;
this.tasks = tasks;
return this;
}
/**
* Form a queue with same {@link #target} and will {@link #start()} in parallel.View on GitHub (pinned to 6237a8cac1)