{"record":{"id":"c8895305232c08d3","repo":"MuntashirAkon/AppManager","slug":"invalid-attribute-name-e-binaryxmlpullparser","errorCode":null,"errorMessage":"Invalid attribute \" + name + \": \" + e","messagePattern":"Invalid attribute \" \\+ name \\+ \": \" \\+ e","errorType":"exception","errorClass":"XmlPullParserException","httpStatus":null,"severity":"error","filePath":"libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java","lineNumber":861,"sourceCode":"                        return Float.parseFloat(valueString);\n                    } catch (Exception e) {\n                        throw new XmlPullParserException(\"Invalid attribute \" + name + \": \" + e);\n                    }\n                default:\n                    throw new XmlPullParserException(\"Invalid conversion from \" + type);\n            }\n        }\n\n        public double getValueDouble() throws XmlPullParserException {\n            switch (type) {\n                case TYPE_DOUBLE:\n                    return valueDouble;\n                case TYPE_STRING:\n                case TYPE_STRING_INTERNED:\n                    try {\n                        return Double.parseDouble(valueString);\n                    } catch (Exception e) {\n                        throw new XmlPullParserException(\"Invalid attribute \" + name + \": \" + e);\n                    }\n                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;","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java#L843-L879","documentation":"Attribute.getValueDouble() throws XmlPullParserException when the attribute's string representation cannot be parsed as a double (stored type TYPE_STRING/TYPE_STRING_INTERNED). The message embeds the attribute name and the underlying NumberFormatException.","triggerScenarios":"Calling getValueDouble() on a string-typed attribute whose value is not a valid double literal, e.g. \"abc\", \"1,5\", or an empty string.","commonSituations":"Binary XML written by another tool/locale where numbers were serialized with commas or units, or a schema change that stored a non-numeric string where a double was expected.","solutions":["Fix the producer to write valid double literals (Locale-invariant formatting, e.g. Double.toString).","Pre-validate the string with Double.parseDouble in a try-catch before parsing, or use a fallback default.","Use the getter matching the attribute's actual type (TYPE_DOUBLE attributes parse directly and won't take this branch).","Catch XmlPullParserException and treat the attribute as missing/invalid."],"exampleFix":"// before\ndouble d = attr.getValueDouble(); // \"1,5\" throws\n// after\ndouble d;\ntry { d = attr.getValueDouble(); }\ncatch (XmlPullParserException e) { d = 0.0; /* or log & recover */ }","handlingStrategy":"validation","validationCode":"String s = attr.getValueString();\nboolean parseable = s != null;\nif (parseable) {\n    try { Double.parseDouble(s); } catch (NumberFormatException e) { parseable = false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n    d = attr.getValueDouble();\n} catch (XmlPullParserException e) {\n    d = DEFAULT_DOUBLE; // log e.getMessage() for diagnostics\n}","preventionTips":["Write numbers with Locale-invariant formatting (Double.toString / String.format(Locale.ROOT)).","Prefer typed attribute setters (writeDouble) over string encoding.","Validate serialized numbers in unit tests for both locales and edge values.","Handle document version skew where a numeric field became a string."],"tags":["xml","parser","number-format"],"backgroundTag":"invalid-argument-format","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"}