{"record":{"id":"d7544ec547eaaaa5","repo":"MuntashirAkon/AppManager","slug":"class-definition-for-src-getfullpath-is-not-found","errorCode":null,"errorMessage":"Class definition for + src.getFullPath() + is not found.","messagePattern":"Class definition for \\+ src\\.getFullPath\\(\\) \\+ is not found\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/io/fs/ApkFileSystem.java","lineNumber":180,"sourceCode":"        //noinspection RedundantIfStatement\n        if (access == OsConstants.R_OK) {\n            return true;\n        }\n        // X_OK, R_OK|X_OK, W_OK, R_OK|W_OK, R_OK|W_OK|X_OK are false\n        return false;\n    }\n\n    @NonNull\n    @Override\n    protected InputStream getInputStream(@NonNull Node<?> node) throws IOException {\n        return new FileInputStream(getCachedFile(node, false));\n    }\n\n    @Override\n    protected void cacheFile(@NonNull Node<?> src, @NonNull File sink) throws IOException {\n        CentralDirectoryRecord cdRecord = (CentralDirectoryRecord) src.getObject();\n        if (cdRecord == null || mApk == null || mApkSections == null) {\n            throw new FileNotFoundException(\"Class definition for \" + src.getFullPath() + \" is not found.\");\n        }\n        DataSource lfhSection = mApk.slice(0, mApkSections.getZipCentralDirectoryOffset());\n        try (FileOutputStream os = new FileOutputStream(sink)) {\n            DataSink out = DataSinks.asDataSink(os);\n            LocalFileRecord.outputUncompressedData(lfhSection, cdRecord, lfhSection.size(), out);\n        } catch (ZipFormatException e) {\n            throw new IOException(e);\n        }\n    }\n\n    @NonNull\n    private static Node<CentralDirectoryRecord> buildTree(@NonNull List<CentralDirectoryRecord> cdRecords) {\n        Node<CentralDirectoryRecord> rootNode = new Node<>(null, File.separator);\n        rootNode.addExtra(\"mtime\", System.currentTimeMillis());\n        for (CentralDirectoryRecord cdRecord : cdRecords) {\n            buildTree(rootNode, cdRecord);\n        }\n        return rootNode;","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/io/fs/ApkFileSystem.java#L162-L198","documentation":"ApkFileSystem.cacheFile extracts a class/dex entry from a mounted APK by writing the corresponding LocalFileRecord to a sink file. The Node's CentralDirectoryRecord is null (or the APK/sections handle is closed), so the entry cannot be located in the APK's central directory; a FileNotFoundException naming the node's full path is thrown.","triggerScenarios":"Copying/caching a file from an APK-backed VirtualFileSystem when node.getObject() (CentralDirectoryRecord) is null, or mApk/mApkSections were never initialized or have been released (filesystem closed/unmounted).","commonSituations":"Accessing an APK mount after the underlying APK was updated/re-signed so cached records are stale; using the VFS after close(); malformed or split APKs where the entry is missing from the central directory.","solutions":["Verify the class entry actually exists in the APK before accessing it (list entries / check the path spelling, it is case-sensitive).","Remount the APK filesystem so Node objects and central-directory records are refreshed against the current APK.","Do not use the filesystem after unmount/close; re-mount and obtain fresh Nodes.","Catch FileNotFoundException and re-check node.getObject() != null before copying."],"exampleFix":"// before\nvfs.copy(node, cacheFile);\n// after\nif (node.getObject() == null) {\n    vfs = VirtualFileSystem.remount(apkUri, options); // refresh records\n    node = vfs.getNode(node.getFullPath());\n}\nvfs.copy(node, cacheFile);","handlingStrategy":"try-catch","validationCode":"if (node.getObject() == null) throw new FileNotFoundException(\"Missing APK entry: \" + node.getFullPath());","typeGuard":"static boolean hasApkRecord(Node<?> n) { return n.getObject() instanceof CentralDirectoryRecord; }","tryCatchPattern":"try {\n    vfs.cacheFile(node, sink);\n} catch (FileNotFoundException e) {\n    // remount APK and retry once, else skip entry\n}","preventionTips":["Remount the APK VFS whenever the APK file changes on disk.","Never use nodes from an unmounted/closed filesystem.","Validate entry existence against the APK entry list before bulk operations."],"tags":["filesystem","apk","file-not-found","android"],"backgroundTag":"file-not-found","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}