{"record":{"id":"0a6fe486728cc746","repo":"pxb1988/dex2jar","slug":"entryname-null","errorCode":null,"errorMessage":"entryName == null","messagePattern":"entryName == null","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"dex-reader/src/main/java/com/googlecode/d2j/util/zip/ZipFile.java","lineNumber":107,"sourceCode":"    public List<? extends ZipEntry> entries() {\n        return entries;\n    }\n\n    /**\n     * Returns this file's comment, or null if it doesn't have one. See {@link java.util.zip.ZipOutputStream#setComment}\n     * .\n     * \n     * @throws IllegalStateException\n     *             if this zip file has been closed.\n     * @since 1.7\n     */\n    public String getComment() {\n        return comment;\n    }\n\n    public ZipEntry findFirstEntry(String entryName) {\n        if (entryName == null) {\n            throw new NullPointerException(\"entryName == null\");\n        }\n\n        ZipEntry ze = findFirstEntry0(entryName);\n        if (ze == null) {\n            ze = findFirstEntry0(entryName + \"/\");\n        }\n        return ze;\n    }\n\n    private ZipEntry findFirstEntry0(String entryName) {\n        for (ZipEntry e : entries) {\n            if (e.getName().equals(entryName)) {\n                return e;\n            }\n        }\n        return null;\n    }\n","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/dex-reader/src/main/java/com/googlecode/d2j/util/zip/ZipFile.java#L89-L125","documentation":"A standard argument guard in findFirstEntry: the caller passed a null entryName, which cannot match any zip entry, so a NullPointerException with the message 'entryName == null' is thrown immediately. The faulting input is the entryName argument itself; the zip file state is irrelevant.","triggerScenarios":"Calling zipFile.findFirstEntry(null), typically when a variable holding the entry name was never assigned or a lookup result was passed through unchecked.","commonSituations":"Programmatic dex/zip tooling where entry names come from user input or config that is missing; reflection-driven extraction of resources.","solutions":["Pass a non-null entry name; check for null before the call","Return early with a default entry or empty result when the name is absent","Use Map-style lookup with containsKey if the API is extended"],"exampleFix":"// before\nZipEntry e = zip.findFirstEntry(name); // NPE if name is null\n// after\nZipEntry e = name == null ? null : zip.findFirstEntry(name);","handlingStrategy":"type-guard","validationCode":"if (entryName == null) return null; // skip lookup","typeGuard":"ZipEntry safeFind(ZipFile z, String n) { return (n == null) ? null : z.findFirstEntry(n); }","tryCatchPattern":"try { return zip.findFirstEntry(name); } catch (NullPointerException e) { return null; } // only as last resort","preventionTips":["Null-check entry names sourced from user input or config before lookup","Make lookup helpers null-safe at the call site","Distinguish 'entry missing' from 'name not provided' in your API"],"tags":["null","zip","argument-check"],"backgroundTag":"null-argument","analyzedSha":"b5bda4fb4935ae8b3869b422454ae3b3896c7bc1","analyzedAt":"2026-09-08T00:44:01.258Z","contentChangedAt":"2026-09-08T00:44:01.258Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}