{"record":{"id":"4bc077635f435b67","repo":"MuntashirAkon/AppManager","slug":"getpositiondescription","errorCode":null,"errorMessage":"${getPositionDescription()}","messagePattern":"\\$\\{getPositionDescription\\(\\)\\}","errorType":"exception","errorClass":"org.xmlpull.v1.XmlPullParserException","httpStatus":null,"severity":"error","filePath":"libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java","lineNumber":350,"sourceCode":"            case \"lt\": return \"<\";\n            case \"gt\": return \">\";\n            case \"amp\": return \"&\";\n            case \"apos\": return \"'\";\n            case \"quot\": return \"\\\"\";\n        }\n        if (entity.length() > 1 && entity.charAt(0) == '#') {\n            final char c = (char) Integer.parseInt(entity.substring(1));\n            return new String(new char[] { c });\n        }\n        throw new XmlPullParserException(\"Unknown entity \" + entity);\n    }\n\n    @Override\n    public void require(int type, String namespace, String name)\n            throws XmlPullParserException, IOException {\n        if (namespace != null && !namespace.isEmpty()) throw illegalNamespace();\n        if (mCurrentToken != type || !Objects.equals(mCurrentName, name)) {\n            throw new XmlPullParserException(getPositionDescription());\n        }\n    }\n\n    @Override\n    public String nextText() throws XmlPullParserException, IOException {\n        if (getEventType() != START_TAG) {\n            throw new XmlPullParserException(getPositionDescription());\n        }\n        int eventType = next();\n        if (eventType == TEXT) {\n            String result = getText();\n            eventType = next();\n            if (eventType != END_TAG) {\n                throw new XmlPullParserException(getPositionDescription());\n            }\n            return result;\n        } else if (eventType == END_TAG) {\n            return \"\";","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java#L332-L368","documentation":"XmlPullParserException thrown by require() when the parser's current token type or element name does not match the expected type/namespace/name passed in. This binary XML parser rejects namespaces entirely (illegalNamespace() is thrown first if a non-empty namespace is given), so require() only checks token type and local name against mCurrentToken and mCurrentName.","triggerScenarios":"Calling require(type, namespace, name) while the parser is positioned on a different token type (e.g. START_TAG expected but parser is on TEXT), or on an element with a different name; or passing a non-null, non-empty namespace which triggers rejection before the type check.","commonSituations":"Parsing Android binary XML (compiled layouts, AXML) that has a different structure than expected; porting code written against the platform XmlPullParser and passing namespaces; deserializing a resource that changed between app versions.","solutions":["Pass null or \"\" as the namespace argument since namespaces are unsupported in this parser","Verify the current event with getEventType() before calling require","Dump the current token and name via getPositionDescription()/getName() to see the actual mismatch","Regenerate or update the expected element name/path to match the actual binary XML"],"exampleFix":"// before\nparser.require(XmlPullParser.START_TAG, \"http://schemas.android.com/apk/res/android\", \"manifest\");\n// after\nparser.require(XmlPullParser.START_TAG, null, \"manifest\");","handlingStrategy":"validation","validationCode":"if (parser.getEventType() == XmlPullParser.START_TAG && \"expectedName\".equals(parser.getName())) {\n    parser.require(XmlPullParser.START_TAG, null, \"expectedName\");\n}","typeGuard":null,"tryCatchPattern":"try { parser.require(XmlPullParser.START_TAG, null, name); } catch (XmlPullParserException e) { throw new IOException(\"Unexpected element at \" + e.getMessage(), e); }","preventionTips":["Always pass null or \"\" as namespace to this parser","Check getEventType() before require()","Log getPositionDescription() output when debugging"],"tags":["xml","parser","binary-xml","android"],"backgroundTag":"invalid-argument-value","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}