{"record":{"id":"e7a619ffb94337e7","repo":"Konloch/bytecode-viewer","slug":"file-getabsolutepath-not-found","errorCode":null,"errorMessage":"'${file.getAbsolutePath()}'  not found.","messagePattern":"'(.+?)'  not found\\.","errorType":"exception","errorClass":"LoaderException","httpStatus":null,"severity":"error","filePath":"src/main/java/the/bytecode/club/bytecodeviewer/decompilers/jdgui/DirectoryLoader.java","lineNumber":60,"sourceCode":"        if (!(file.exists() && file.isDirectory()))\n            throw new LoaderException(\"'\" + codebase + \"' is not a directory\");\n    }\n\n    @Override\n    public byte[] load(String internalPath) throws LoaderException\n    {\n        if (!internalPath.endsWith(\".class\"))\n            internalPath = internalPath + \".class\";\n\n        File file = new File(this.codebase, internalPath);\n\n        try (FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis))\n        {\n            return IOUtils.toByteArray(bis);\n        }\n        catch (IOException e)\n        {\n            throw new LoaderException(\"'\" + file.getAbsolutePath() + \"'  not found.\");\n        }\n    }\n\n    @Override\n    public boolean canLoad(String internalPath)\n    {\n        File file = new File(this.codebase, internalPath + \".class\");\n        return file.exists() && file.isFile();\n    }\n}\n","sourceCodeStart":42,"sourceCodeEnd":71,"githubUrl":"https://github.com/Konloch/bytecode-viewer/blob/31430e0033fa220db566b5ef461256727ff6793b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/jdgui/DirectoryLoader.java#L42-L71","documentation":"DirectoryLoader.load() wraps any IOException from opening/reading the requested .class file on disk into a LoaderException whose message is the resolved absolute path plus 'not found.' It is thrown whenever FileInputStream construction or stream reading fails for the codebase+internalPath combination, whether the file truly does not exist or is unreadable (permission, directory, I/O error). The library conflates all IOExceptions into a single 'not found' message.","triggerScenarios":"Calling load(internalPath) (directly or via jd.core decompilation of a directory-based codebase) where codebase/internalPath (with .class appended if missing) does not exist, is a directory, lacks read permission, or an I/O error occurs while reading.","commonSituations":"Passing an internal path with the wrong package separators or a stale class name after refactoring; pointing the DirectoryLoader at an output directory that was cleaned while decompilation is in flight; files filtered out by obfuscation tools; OS permission issues; symlinks broken after moving the directory.","solutions":["Verify the file exists and is readable at the exact path printed in the message before calling load(): new File(codebase, path.endsWith(\".class\") ? path : path + \".class\").exists().","Check package separators: internalPath must use '/' internally; the loader appends '.class' if absent, so do not pre-append '.class' twice or pass OS separators.","Rebuild/restore the class directory or re-point the DirectoryLoader constructor at a directory that actually contains the compiled classes (constructor already validates it is a directory).","Fix filesystem permissions (chmod/chown) if the path exists but the JVM cannot read it; note permission failures also surface as this 'not found.' message.","Catch LoaderException per-file in your caller and skip/log the class rather than aborting the whole decompilation run."],"exampleFix":"// before\nbyte[] bytes = loader.load(\"com/example/Missing.class\");\n\n// after\nif (loader.canLoad(\"com/example/Missing\")) {\n    byte[] bytes = loader.load(\"com/example/Missing.class\");\n} else {\n    // handle missing class: skip, log, or load from another loader\n}","handlingStrategy":"validation","validationCode":"File f = new File(codebase, internalPath.endsWith(\".class\") ? internalPath : internalPath + \".class\");\nif (!f.exists() || !f.isFile()) throw new IllegalStateException(\"Class file missing: \" + f.getAbsolutePath());","typeGuard":"static boolean classFileExists(String codebase, String internalPath) {\n    String p = internalPath.endsWith(\".class\") ? internalPath : internalPath + \".class\";\n    File f = new File(codebase, p);\n    return f.isFile();\n}","tryCatchPattern":"try {\n    byte[] bytes = loader.load(internalPath);\n} catch (org.jd.core.v1.api.loader.LoaderException e) {\n    logger.warn(\"Class not loadable: {}\", e.getMessage());\n    // fallback: skip class or load from alternate loader\n}","preventionTips":["Call canLoad(internalPath) before load() — it returns false without throwing.","Always pass internal paths using '/' separators, never OS-specific separators.","Keep the class directory intact for the whole decompilation run; avoid cleaning build output mid-run.","Check read permissions on the codebase directory before batch processing.","Catch LoaderException per file so one missing class does not abort the batch."],"tags":["java","io","file-not-found","decompiler"],"backgroundTag":"file-not-found","analyzedSha":"31430e0033fa220db566b5ef461256727ff6793b","analyzedAt":"2026-09-05T18:22:22.725Z","contentChangedAt":"2026-09-05T18:22:22.725Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}