{"record":{"id":"af7f4ddf0b5163d2","repo":"MuntashirAkon/AppManager","slug":"ioexception","errorCode":null,"errorMessage":"IOException","messagePattern":"IOException","errorType":"exception","errorClass":"ApkFileException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java","lineNumber":237,"sourceCode":"                    extension = \"xapk\";\n                    break;\n                case \"application/vnd.apkm\":\n                    extension = \"apkm\";\n                    break;\n                default:\n                    extension = \"apk\";\n                    break;\n            }\n        }\n        if (extension.equals(\"apkm\")) {\n            try {\n                if (FileUtils.isZip(apkSource)) {\n                    // DRM-free APKM file, mark it as APKS\n                    // FIXME(#227): Give it a special name and verify integrity\n                    extension = \"apks\";\n                }\n            } catch (IOException | SecurityException e) {\n                throw new ApkFileException(e);\n            }\n        }\n        // Cache the file or use file descriptor for non-APKM files\n        if (extension.equals(\"apkm\")) {\n            // Convert to APKS\n            try {\n                mCacheFilePath = mFileCache.createCachedFile(\"apks\");\n                try (ParcelFileDescriptor inputFD = FileUtils.getFdFromUri(context, apkUri, \"r\");\n                     OutputStream outputStream = new FileOutputStream(mCacheFilePath)) {\n                    UnApkm unApkm = new UnApkm(context, UN_APKM_PKG);\n                    unApkm.decryptFile(inputFD, outputStream);\n                }\n            } catch (IOException | RemoteException e) {\n                throw new ApkFileException(e);\n            }\n        } else {\n            // Open file descriptor if necessary\n            File cacheFilePath = null;","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java#L219-L255","documentation":"When the source resolves to an .apkm package, ApkFile probes it with FileUtils.isZip to detect a DRM-free APKM; the zip sniffing threw IOException (unreadable file/URI, I/O failure) or SecurityException (no read permission), so construction aborts early with ApkFileException. The input at fault is the apkUri content stream for the apkm file.","triggerScenarios":"Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java:237 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the URI is readable (persistable/read permission granted for content URIs) before constructing ApkFile","Re-download or re-export the APKM file if it is truncated or corrupted","Catch ApkFileException at the call site and surface the cause to the user"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}