{"record":{"id":"1f774525d1d819fd","repo":"Tencent/tinker","slug":"name-null","errorCode":null,"errorMessage":"name == null","messagePattern":"name == null","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"third-party/tinker-ziputils/src/main/java/com/tencent/tinker/ziputils/ziputil/TinkerZipEntry.java","lineNumber":84,"sourceCode":"        this.compressedSize = compressedSize;\n        this.size = size;\n        this.compressionMethod = compressionMethod;\n        this.time = time;\n        this.modDate = modDate;\n        this.extra = extra;\n        this.localHeaderRelOffset = localHeaderRelOffset;\n        this.dataOffset = dataOffset;\n    }\n    /**\n     * Constructs a new {@code ZipEntry} with the specified name. The name is actually a path,\n     * and may contain {@code /} characters.\n     *\n     * @throws IllegalArgumentException\n     *             if the name length is outside the range (> 0xFFFF).\n     */\n    public TinkerZipEntry(String name) {\n        if (name == null) {\n            throw new NullPointerException(\"name == null\");\n        }\n        validateStringLength(\"Name\", name);\n        this.name = name;\n    }\n    /**\n     * Constructs a new {@code ZipEntry} using the values obtained from {@code\n     * ze}.\n     *\n     * @param ze\n     *            the {@code ZipEntry} from which to obtain values.\n     */\n    public TinkerZipEntry(TinkerZipEntry ze) {\n        name = ze.name;\n        comment = ze.comment;\n        time = ze.time;\n        size = ze.size;\n        compressedSize = ze.compressedSize;\n        crc = ze.crc;","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/third-party/tinker-ziputils/src/main/java/com/tencent/tinker/ziputils/ziputil/TinkerZipEntry.java#L66-L102","documentation":"TinkerZipEntry's name constructor requires a non-null name; passing null throws NullPointerException(\"name == null\") immediately (name validation for length happens next, in validateStringLength). TinkerZipEntry is this library's self-contained clone of java.util.zip.ZipEntry, so it keeps the same fail-fast contract as the platform class.","triggerScenarios":"Constructing new TinkerZipEntry(name) where name came from a null-producing source: a map lookup miss, a path join returning null, or splitting an entry name on a separator that produced an empty/null segment.","commonSituations":"Repackaging loops keyed by string maps where absent keys yield null; code ported from java.util.zip that assumed a different null policy; test fixtures creating entries from uninitialized fields.","solutions":["Null-check (or Objects.requireNonNull) the name at the point of construction with a descriptive message naming the source of the value.","Fix the upstream lookup so missing names surface as an explicit error (key not found) rather than silently becoming null.","Default to a computed fallback name (e.g. \"entry-\" + index) only if an anonymous entry is genuinely intended."],"exampleFix":"// before: map lookup may return null\nentryList.add(new TinkerZipEntry(nameById.get(id))); // NPE: name == null\n\n// after: fail fast with context\nString name = nameById.get(id);\nif (name == null) throw new IllegalArgumentException(\"no entry name for id \" + id);\nentryList.add(new TinkerZipEntry(name));","handlingStrategy":"validation","validationCode":"String name = source != null ? source.getName() : null;\njava.util.Objects.requireNonNull(name, \"entry name source produced null\");\nnew TinkerZipEntry(name);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail fast on null names at the source (lookup miss = explicit error).","Objects.requireNonNull at your boundary with a message naming the producer.","Avoid nullable String fields for names; initialize to a computed placeholder if anonymity is intended."],"tags":["zip","null-check","constructor","tinker"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}