lingochamp/FileDownloader · error · NullPointerException
value == null
Error message
value == null
What it means
This is a generic validation guard inside FileDownloadHeader.add(name, value): it rejects the request-header value passed by the caller when it is null. It fires because the caller supplied a header entry whose value is null (e.g. an unset or unfilled custom header via FileDownloader request headers); the guard throws instead of adding a null value to the underlying header map, since HTTP header values must be non-null strings.
Solutions
- Provide a non-null header value, e.g. header.add("If-Match", etag)
- Guard with value != null before add when the value is computed conditionally (a missing Etag or redirect target often surfaces as null)
- Use an empty string or skip the header entirely if the value is genuinely absent
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at library/src/main/java/com/liulishuo/filedownloader/model/FileDownloadHeader.java:43 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/7a6db942c935aa64.
Report an issue: GitHub.
Appendix: source
Thrown at library/src/main/java/com/liulishuo/filedownloader/model/FileDownloadHeader.java:43
/**
* 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);
}
}
/**
* We have already handled etag, and will add 'If-Match' & 'Range' value if it works.View on GitHub (pinned to 6237a8cac1)