{"record":{"id":"7baaf918da499d3f","repo":"pxb1988/dex2jar","slug":"not-a-validate-method-desc-s","errorCode":null,"errorMessage":"not a validate Method Desc %s","messagePattern":"not a validate Method Desc (.+?)","errorType":"exception","errorClass":"DexException","httpStatus":null,"severity":"error","filePath":"dex-translator/src/main/java/com/googlecode/d2j/util/Types.java","lineNumber":17,"sourceCode":"package com.googlecode.d2j.util;\n\nimport com.googlecode.d2j.DexException;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class Types {\n    /**\n     * @param desc\n     *            a asm method desc, ex: (II)V\n     * @return a array of argument types, ex: [I,I]\n     */\n    public static String[] getParameterTypeDesc(String desc) {\n\n        if (desc.charAt(0) != '(') {\n            throw new DexException(\"not a validate Method Desc %s\", desc);\n        }\n        int x = desc.lastIndexOf(')');\n        if (x < 0) {\n            throw new DexException(\"not a validate Method Desc %s\", desc);\n        }\n        List<String> ps = listDesc(desc.substring(1, x - 1));\n        return ps.toArray(new String[ps.size()]);\n    }\n\n    /**\n     * \n     * @param desc\n     *            a asm method desc, ex: (II)V\n     * @return the desc of return type, ex: V\n     */\n    public static String getReturnTypeDesc(String desc) {\n        int x = desc.lastIndexOf(')');\n        if (x < 0) {","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/dex-translator/src/main/java/com/googlecode/d2j/util/Types.java#L1-L35","documentation":"Types.getParameterTypeDesc parses an ASM-style method descriptor such as '(II)V' into its parameter type descriptors. It validates that the descriptor begins with '(' and throws DexException 'not a validate Method Desc %s' immediately if the first character is not '(' — the descriptor is malformed.","triggerScenarios":"Calling Types.getParameterTypeDesc(desc) with a string whose first char is not '(', e.g. passing a bare type desc like 'I' or 'Ljava/lang/String;', an empty string, a plain class name, or a signature instead of a method descriptor.","commonSituations":"Mixing up field/type descriptors with method descriptors when reflecting on dex/asm types; passing a Proguard-smali style name; reading a descriptor from a malformed or obfuscated dex entry; off-by-one substring slicing upstream stripping the '(' character.","solutions":["Verify the string is a full method descriptor starting with '(' and containing ')', e.g. '(II)V', before calling","Print/inspect the offending desc in the exception message to find where the truncated or wrong value originates","If the input may be a bare type, use the type-descriptor parser instead of the method-descriptor one","Check upstream callers (e.g. dex method parsing) for corrupted descriptors from a damaged/obfuscated dex file — try re-obtaining the dex from the original APK"],"exampleFix":"// before\nString[] ps = Types.getParameterTypeDesc(\"II\");\n// after\nString desc = \"(II)V\";\nif (desc != null && desc.startsWith(\"(\")) {\n    String[] ps = Types.getParameterTypeDesc(desc);\n}","handlingStrategy":"validation","validationCode":"public static void requireMethodDesc(String desc) {\n    if (desc == null || desc.isEmpty() || desc.charAt(0) != '(')\n        throw new IllegalArgumentException(\"not a method desc: \" + desc);\n}","typeGuard":"static boolean isMethodDesc(String s) {\n    return s != null && s.startsWith(\"(\") && s.indexOf(')') > 0;\n}","tryCatchPattern":"try {\n    String[] ps = Types.getParameterTypeDesc(desc);\n} catch (DexException e) {\n    // log e.getMessage() which embeds the offending desc and fix upstream\n}","preventionTips":["Never pass bare type/field descriptors where a method descriptor is expected","Validate the leading '(' and presence of ')' before parsing","Beware substring slicing that could strip the opening paren"],"tags":["java","dex","descriptor-parsing","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"b5bda4fb4935ae8b3869b422454ae3b3896c7bc1","analyzedAt":"2026-09-08T00:44:01.258Z","contentChangedAt":"2026-09-08T00:44:01.258Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}