{"record":{"id":"10b84bcf0784561b","repo":"pinpoint-apm/pinpoint","slug":"not-found-10b84b","errorCode":null,"errorMessage":" not found","messagePattern":" not found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarFileUtils.java","lineNumber":34,"sourceCode":"\npackage com.navercorp.pinpoint.bootstrap.agentdir;\n\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.util.Objects;\nimport java.util.jar.JarFile;\n\n/**\n * @author Woonduk Kang(emeroad)\n */\nfinal class JarFileUtils {\n\n    public static JarFile openJarFile(Path path) {\n        Objects.requireNonNull(path, \"path\");\n\n        if (!Files.exists(path)) {\n            throw new IllegalArgumentException(path + \" not found\");\n        }\n        if (Files.isDirectory(path)) {\n            throw new IllegalArgumentException(path + \" is directory\");\n        }\n        if (!Files.isRegularFile(path)) {\n            throw new IllegalArgumentException(path + \" not file\");\n        }\n        if (!Files.isReadable(path)) {\n            throw new IllegalArgumentException(path + \" can read\");\n        }\n        try {\n            return new JarFile(path.toFile());\n        } catch (IOException e) {\n            throw new IllegalStateException(path + \" create fail Caused by:\" + e.getMessage(), e);\n        }\n    }\n}\n","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarFileUtils.java#L16-L52","documentation":"JarFileUtils.openJarFile(Path) validates its argument before opening a JAR. If Files.exists(path) is false it throws IllegalArgumentException with \"<path> not found\". It is a precondition check so callers get a clear message instead of an obscure JarFile/IOException later.","triggerScenarios":"Calling JarFileUtils.openJarFile(path) with a path that does not exist on disk — file was deleted/moved, the path string is wrong, or the parent directory was resolved relative to an unexpected working directory.","commonSituations":"Plugin/agent JAR removed after startup enumeration (stale path in a list); misspelled JAR file name in configuration; relative paths resolved against a different process working directory; deployment packaging that omitted the JAR.","solutions":["Check the exact path exists before opening: `ls -l <path>` or Files.exists(path).","Fix the caller to pass the resolved absolute path (path.toAbsolutePath()) of an actual JAR.","If the JAR was legitimately removed, refresh the list of candidate JARs instead of keeping stale entries.","Correct the file name/path in configuration to match the deployed JAR."],"exampleFix":"// before\nJarFile jar = JarFileUtils.openJarFile(Paths.get(\"plugins\", \"my-plugin.jar\")); // may not exist\n// after\nPath p = Paths.get(\"plugins\", \"my-plugin.jar\").toAbsolutePath();\nif (Files.exists(p)) {\n    JarFile jar = JarFileUtils.openJarFile(p);\n}","handlingStrategy":"validation","validationCode":"Path p = candidate.toAbsolutePath();\nif (!Files.exists(p)) {\n    throw new IllegalArgumentException(\"JAR does not exist: \" + p);\n}","typeGuard":null,"tryCatchPattern":"try {\n    JarFile jar = JarFileUtils.openJarFile(path);\n} catch (IllegalArgumentException e) {\n    logger.warn(\"Skipping unavailable JAR {}: {}\", path, e.getMessage());\n}","preventionTips":["Resolve paths to absolute form before opening (working directory may differ).","Refresh JAR listings at the point of use instead of caching paths collected earlier.","Validate configured JAR paths at configuration-load time.","Keep file names and their config references in sync during upgrades."],"tags":["jar","file-not-found","illegal-argument","validation"],"backgroundTag":"file-not-found","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}