{"record":{"id":"8e307b1581042a24","repo":"Tencent/matrix","slug":"taskexecuteexception-wrapping-e-getmessage-8e307b","errorCode":null,"errorMessage":"TaskExecuteException wrapping e.getMessage()","messagePattern":"TaskExecuteException wrapping e\\.getMessage\\(\\)","errorType":"exception","errorClass":"TaskExecuteException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/ManifestAnalyzeTask.java","lineNumber":91,"sourceCode":"            ManifestParser manifestParser = null;\n            if (!FileUtil.isLegalFile(arscFile)) {\n                manifestParser = new ManifestParser(inputFile);\n            } else {\n                manifestParser = new ManifestParser(inputFile, arscFile);\n            }\n            TaskResult taskResult = TaskResultFactory.factory(getType(), TASK_RESULT_TYPE_JSON, config);\n            if (taskResult == null) {\n                return null;\n            }\n            long startTime = System.currentTimeMillis();\n            JsonObject jsonObject = manifestParser.parse();\n            Log.d(TAG, jsonObject.toString());\n            ((TaskJsonResult) taskResult).add(\"manifest\", jsonObject);\n            taskResult.setStartTime(startTime);\n            taskResult.setEndTime(System.currentTimeMillis());\n            return taskResult;\n        } catch (Exception e) {\n            throw new TaskExecuteException(e.getMessage(), e);\n        }\n    }\n}\n","sourceCodeStart":73,"sourceCodeEnd":95,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/ManifestAnalyzeTask.java#L73-L95","documentation":"ManifestAnalyzeTask.call() wraps any Exception raised while parsing AndroidManifest.xml (via the axml parsing library and Res StreamReader) into TaskExecuteException with e.getMessage(). Typical wrapped causes are malformed/undecodable binary XML, missing resources.arsc, or stream parsing errors.","triggerScenarios":"call() fails when the manifest XML is corrupt or in unexpected format, resources.arsc is missing/mismatched, or an IOException occurs while streaming the manifest.","commonSituations":"Analyzing an APK processed by aggressive resource obfuscation; manifest from a newer AAPT2 format the parser can't handle; truncated download/copy of the APK before unzipping.","solutions":["Inspect the cause chain to find the real parsing error (corrupt XML, missing arsc, IO).","Re-unzip a freshly built/intact APK and retry the analysis.","If the APK uses resource obfuscation, analyze the original un-obfuscated build or a matrix-compatible tool version.","Update Matrix to the latest version for newer AAPT2/binary-XML format support."],"exampleFix":"// before\n// analyzing an obfuscated APK: resources.arsc names stripped, parse fails\n// after\n// run the checker on the un-obfuscated APK build output\nApkChecker.run(configWithUnzippedPath(originalApkBuildDir));","handlingStrategy":"try-catch","validationCode":"File manifest = new File(config.getUnzipPath(), \"AndroidManifest.xml\");\nFile arsc = new File(config.getUnzipPath(), \"resources.arsc\");\nif (!manifest.exists() || !arsc.exists()) {\n    throw new IllegalStateException(\"manifest/resources.arsc must exist and be intact for parsing\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    taskResult = manifestAnalyzeTask.call();\n} catch (TaskExecuteException e) {\n    log.severe(\"manifest parse failed: \" + e.getMessage() + \" cause=\" + e.getCause());\n    // re-unzip intact APK or upgrade Matrix parser, then retry\n}","preventionTips":["Check e.getCause() to see the underlying parse failure.","Avoid analyzing resource-obfuscated APKs whose manifest/arsc layout changed.","Keep Matrix updated for newer AAPT2 binary XML formats.","Verify APK integrity (unzip succeeds fully) before manifest analysis."],"tags":["android","apk-checker","manifest","parsing","wrapped-exception"],"backgroundTag":"json-parse-error","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}