{"record":{"id":"ce8d5f6112103356","repo":"Tencent/tinker","slug":"entryname-null","errorCode":null,"errorMessage":"entryName == null","messagePattern":"entryName == null","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"third-party/tinker-ziputils/src/main/java/com/tencent/tinker/ziputils/ziputil/TinkerZipFile.java","lineNumber":314,"sourceCode":"     * See {@link ZipOutputStream#setComment}.\n     *\n     * @throws IllegalStateException if this zip file has been closed.\n     * @since 1.7\n     */\n    public String getComment() {\n        checkNotClosed();\n        return comment;\n    }\n\n    /**\n     * Returns the zip entry with the given name, or null if there is no such entry.\n     *\n     * @throws IllegalStateException if this zip file has been closed.\n     */\n    public TinkerZipEntry getEntry(String entryName) {\n        checkNotClosed();\n        if (entryName == null) {\n            throw new NullPointerException(\"entryName == null\");\n        }\n        TinkerZipEntry ze = entries.get(entryName);\n        if (ze == null) {\n            ze = entries.get(entryName + \"/\");\n        }\n        return ze;\n    }\n\n    /**\n     * Returns an input stream on the data of the specified {@code ZipEntry}.\n     *\n     * @param entry\n     *            the ZipEntry.\n     * @return an input stream of the data contained in the {@code ZipEntry}.\n     * @throws IOException\n     *             if an {@code IOException} occurs.\n     * @throws IllegalStateException if this zip file has been closed.\n     */","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/third-party/tinker-ziputils/src/main/java/com/tencent/tinker/ziputils/ziputil/TinkerZipFile.java#L296-L332","documentation":"getEntry explicitly rejects a null entry name with NullPointerException('entryName == null') before consulting the entries map. This is a fail-fast guard for programmer error rather than file corruption — the map lookup would otherwise return null and the caller would misread a bug as 'entry missing'. The check runs after checkNotClosed(), so a closed file fails first with IllegalStateException.","triggerScenarios":"Calling getEntry(null): typically a variable that was never assigned, a map.get() that returned null and was passed straight through, or a config key/property that was absent from the environment.","commonSituations":"Reading the entry name from a config file or command-line argument that was not provided; downstream of a failed lookup ('get the entry for X' where X itself was computed from missing data); refactoring that dropped an initialization.","solutions":["Validate the name is non-null (and non-empty) before the call and fail with your own contextual message identifying which config/source produced it.","Trace where the null came from: usually a missing property or map key one frame up the stack.","Add a default/required check at the config boundary so the name can never reach the zip layer unset."],"exampleFix":"// before\nString name = System.getProperty(\"patch.entry\"); // null if unset\nzf.getEntry(name);\n\n// after\nString name = System.getProperty(\"patch.entry\");\nif (name == null || name.isEmpty()) {\n    throw new IllegalArgumentException(\"patch.entry property is required\");\n}\nTinkerZipEntry e = zf.getEntry(name);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(entryName, \"entryName must come from config key 'patch.entry'\");\nif (entryName.isEmpty()) {\n    throw new IllegalArgumentException(\"entryName is empty\");\n}\nTinkerZipEntry e = zf.getEntry(entryName);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate required names at the config boundary with contextual error messages.","Never pass through values from Map.get/properties without a null check.","Use Objects.requireNonNull with a message naming the source of the value."],"tags":["zip","null-check","api-misuse","tinker"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}