{"record":{"id":"4f3f1ce41c133aa7","repo":"MuntashirAkon/AppManager","slug":"invalid-attribute-name-valuestring","errorCode":null,"errorMessage":"Invalid attribute \" + name + \": \" + valueString","messagePattern":"Invalid attribute \" \\+ name \\+ \": \" \\+ valueString","errorType":"exception","errorClass":"XmlPullParserException","httpStatus":null,"severity":"error","filePath":"libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java","lineNumber":881,"sourceCode":"                default:\n                    throw new XmlPullParserException(\"Invalid conversion from \" + type);\n            }\n        }\n\n        public boolean getValueBoolean() throws XmlPullParserException {\n            switch (type) {\n                case TYPE_BOOLEAN_TRUE:\n                    return true;\n                case TYPE_BOOLEAN_FALSE:\n                    return false;\n                case TYPE_STRING:\n                case TYPE_STRING_INTERNED:\n                    if (\"true\".equalsIgnoreCase(valueString)) {\n                        return true;\n                    } else if (\"false\".equalsIgnoreCase(valueString)) {\n                        return false;\n                    } else {\n                        throw new XmlPullParserException(\n                                \"Invalid attribute \" + name + \": \" + valueString);\n                    }\n                default:\n                    throw new XmlPullParserException(\"Invalid conversion from \" + type);\n            }\n        }\n    }\n\n    // NOTE: To support unbundled clients, we include an inlined copy\n    // of hex conversion logic from HexDump below\n    private final static char[] HEX_DIGITS =\n            { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };\n\n    private static int toByte(char c) {\n        if (c >= '0' && c <= '9') return (c - '0');\n        if (c >= 'A' && c <= 'F') return (c - 'A' + 10);\n        if (c >= 'a' && c <= 'f') return (c - 'a' + 10);\n        throw new IllegalArgumentException(\"Invalid hex char '\" + c + \"'\");","sourceCodeStart":863,"sourceCodeEnd":899,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java#L863-L899","documentation":"Attribute.getValueBoolean() throws XmlPullParserException when a TYPE_STRING/TYPE_STRING_INTERNED attribute holds a value that is neither \"true\" nor \"false\" (case-insensitive). The message includes the attribute name and the offending string.","triggerScenarios":"Calling getValueBoolean() on a string-typed attribute with a value like \"yes\", \"1\", \"on\", or an empty string.","commonSituations":"Hand-edited or third-party binary XML where booleans were stored as \"1\"/\"0\" or \"enabled\"/\"disabled\", or locale/schema mismatches between writer and reader.","solutions":["Normalize the writer to emit \"true\"/\"false\" for boolean attributes.","Accept alternate spellings by reading as string and mapping \"1\"/\"yes\"/\"on\" manually.","Use getValueInt() if the producer stores booleans as 0/1 integers.","Catch XmlPullParserException and apply a default."],"exampleFix":"// before\nboolean b = attr.getValueBoolean(); // \"1\" throws\n// after\nboolean b = \"1\".equals(attr.getValueString()) || attr.getValueBoolean();","handlingStrategy":"validation","validationCode":"String s = attr.getValueString();\nboolean boolReadable = \"true\".equalsIgnoreCase(s) || \"false\".equalsIgnoreCase(s);","typeGuard":null,"tryCatchPattern":"try {\n    b = attr.getValueBoolean();\n} catch (XmlPullParserException e) {\n    b = false; // or map alternate spellings\n}","preventionTips":["Serialize booleans strictly as \"true\"/\"false\" strings or TYPE_BOOLEAN_TRUE/FALSE.","Reject \"1\"/\"0\"/\"yes\"/\"no\" at write time with schema validation.","Normalize third-party documents before parsing.","Prefer typed boolean attribute setters over string booleans."],"tags":["xml","parser","boolean"],"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-14T16:17:12.679Z"}