{"record":{"id":"7a6db942c935aa64","repo":"lingochamp/FileDownloader","slug":"value-null","errorCode":null,"errorMessage":"value == null","messagePattern":"value == null","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"library/src/main/java/com/liulishuo/filedownloader/model/FileDownloadHeader.java","lineNumber":43,"sourceCode":"\n/**\n * We have already handled Etag internal for guaranteeing tasks resuming from the breakpoint, in\n * other words, if the task has downloaded and got Etag, we will add the 'If-Match' and the 'Range'\n * K-V to its request header automatically.\n */\npublic class FileDownloadHeader implements Parcelable {\n\n    private HashMap<String, List<String>> mHeaderMap;\n\n    /**\n     * We have already handled etag, and will add 'If-Match' & 'Range' value if it works.\n     *\n     * @see com.liulishuo.filedownloader.download.ConnectTask#addUserRequiredHeader\n     */\n    public void add(String name, String value) {\n        if (name == null) throw new NullPointerException(\"name == null\");\n        if (name.isEmpty()) throw new IllegalArgumentException(\"name is empty\");\n        if (value == null) throw new NullPointerException(\"value == null\");\n\n        if (mHeaderMap == null) {\n            mHeaderMap = new HashMap<>();\n        }\n\n        List<String> values = mHeaderMap.get(name);\n        if (values == null) {\n            values = new ArrayList<>();\n            mHeaderMap.put(name, values);\n        }\n\n        if (!values.contains(value)) {\n            values.add(value);\n        }\n    }\n\n    /**\n     * We have already handled etag, and will add 'If-Match' & 'Range' value if it works.","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/lingochamp/FileDownloader/blob/6237a8cac174bcc916e4342b14ab1ab72a5768d4/library/src/main/java/com/liulishuo/filedownloader/model/FileDownloadHeader.java#L25-L61","documentation":"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.","triggerScenarios":"Thrown at library/src/main/java/com/liulishuo/filedownloader/model/FileDownloadHeader.java:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"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"}