lingochamp/FileDownloader · error · IllegalArgumentException
name is empty
Error message
name is empty
What it means
A precondition check inside FileDownloadHeader.add: an empty (zero-length) header name is not a valid HTTP header key, so add(name, value) rejects it. The faulty input is a non-null but empty 'name' string.
Solutions
- Supply a real header name such as "Accept" or "Range" instead of an empty string
- Trim and validate that the header name is non-empty before calling add
- Check where the header map is built for logic that produces "" keys (e.g. string concatenation or config parsing bugs)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at library/src/main/java/com/liulishuo/filedownloader/model/FileDownloadHeader.java:42 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/dffe1d3a9e705e86.
Report an issue: GitHub.
Appendix: source
Thrown at library/src/main/java/com/liulishuo/filedownloader/model/FileDownloadHeader.java:42
import java.util.List;
/**
* We have already handled Etag internal for guaranteeing tasks resuming from the breakpoint, in
* other words, if the task has downloaded and got Etag, we will add the 'If-Match' and the 'Range'
* K-V to its request header automatically.
*/
public class FileDownloadHeader implements Parcelable {
private HashMap<String, List<String>> mHeaderMap;
/**
* We have already handled etag, and will add 'If-Match' & 'Range' value if it works.
*
* @see com.liulishuo.filedownloader.download.ConnectTask#addUserRequiredHeader
*/
public void add(String name, String value) {
if (name == null) throw new NullPointerException("name == null");
if (name.isEmpty()) throw new IllegalArgumentException("name is empty");
if (value == null) throw new NullPointerException("value == null");
if (mHeaderMap == null) {
mHeaderMap = new HashMap<>();
}
List<String> values = mHeaderMap.get(name);
if (values == null) {
values = new ArrayList<>();
mHeaderMap.put(name, values);
}
if (!values.contains(value)) {
values.add(value);
}
}
/**View on GitHub (pinned to 6237a8cac1)