{"record":{"id":"2404ca5bf23f0d11","repo":"Tencent/matrix","slug":"e-getmessage-2404ca","errorCode":null,"errorMessage":"<e.getMessage()>","messagePattern":"<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/UnusedResourcesTask.java","lineNumber":498,"sourceCode":"            unusedResSet.addAll(resourceDefMap.values());\n            Log.i(TAG, \"find resource declarations %d items.\", unusedResSet.size());\n            decodeCode();\n            Log.i(TAG, \"find resource references in classes: %d items.\", resourceRefSet.size());\n            decodeResources();\n            Log.i(TAG, \"find resource references %d items.\", resourceRefSet.size());\n            unusedResSet.removeAll(resourceRefSet);\n            Log.i(TAG, \"find unused references %d items\", unusedResSet.size());\n            Log.d(TAG, \"find unused references %s\", unusedResSet.toString());\n            JsonArray jsonArray = new JsonArray();\n            for (String name : unusedResSet) {\n                jsonArray.add(name);\n            }\n            ((TaskJsonResult) taskResult).add(\"unused-resources\", jsonArray);\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":480,"sourceCodeEnd":502,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnusedResourcesTask.java#L480-L502","documentation":"UnusedResourcesTask.call() wraps any Exception thrown while computing unused resources into a TaskExecuteException with e.getMessage() as the message and the original as cause. Like UnusedAssetsTask, it is a generic wrapper; the actionable info is in the cause.","triggerScenarios":"Any exception during call(): file IO while scanning res/ directories, parsing R.txt/mapping files, JSON result building, or the resource-cycle IllegalStateException from readChildReference().","commonSituations":"Missing/odd res directory contents, malformed R.txt or mapping files, cyclic resources, or unreadable files in the extracted APK on CI.","solutions":["Inspect TaskExecuteException.getCause() for the real failure","Validate R.txt and mapping files are readable and well-formed before the task","If the cause is 'Found resource cycle!', break the cycle or ignore those resources","Re-extract the APK and re-run to rule out corrupted input"],"exampleFix":"// before\nthrow new TaskExecuteException(e.getMessage(), e);\n// after\nthrow new TaskExecuteException(\"UnusedResourcesTask failed: \" + e, e);","handlingStrategy":"try-catch","validationCode":"File rTxt = new File(params.get(JobConstants.PARAM_R_TXT));\nFile dir = new File(config.getUnzipPath());\nif (!rTxt.isFile() || !dir.isDirectory()) throw new IllegalStateException(\"invalid inputs for unused-resources task\");","typeGuard":null,"tryCatchPattern":"try {\n    TaskResult r = task.call();\n} catch (TaskExecuteException e) {\n    Throwable cause = e.getCause();\n    log.error(\"unused-resources failed\", cause != null ? cause : e);\n}","preventionTips":["Always log getCause(), the wrapper message can be null or unhelpful","Pre-validate R.txt, mapping, and unzip directory before the job","Re-extract the APK if inputs may be stale or corrupted"],"tags":["android","apk-analysis","exception-wrapper"],"backgroundTag":"file-read-failed","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"}