{"record":{"id":"8dcf25f4aba25f22","repo":"MuntashirAkon/AppManager","slug":"invalid-boolean-value-rawvalue","errorCode":null,"errorMessage":"Invalid boolean value: ${rawValue}","messagePattern":"Invalid boolean value: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/intercept/IntentCompat.java","lineNumber":261,"sourceCode":"                // again for the regex, thus four escape characters become one.\n                String[] strings = rawValue.split(\"(?<!\\\\\\\\),\");\n                ArrayList<String> list = new ArrayList<>(strings.length);\n                Collections.addAll(list, strings);\n                return list;\n            }\n            case TYPE_BOOLEAN: {\n                // Boolean.valueOf() results in false for anything that is not \"true\", which is\n                // error-prone in shell commands\n                boolean boolValue;\n                if (\"true\".equals(rawValue) || \"t\".equals(rawValue)) {\n                    boolValue = true;\n                } else if (\"false\".equals(rawValue) || \"f\".equals(rawValue)) {\n                    boolValue = false;\n                } else {\n                    try {\n                        boolValue = IntegerCompat.decode(rawValue) != 0;\n                    } catch (NumberFormatException ex) {\n                        throw new IllegalArgumentException(\"Invalid boolean value: \" + rawValue);\n                    }\n                }\n                return boolValue;\n            }\n            default:\n                throw new IllegalArgumentException(\"Unknown type: \" + type);\n        }\n    }\n\n    @Nullable\n    private static Pair<Integer, String> valueToParsableStringAndType(@Nullable Object object) {\n        if (object == null) {\n            return new Pair<>(TYPE_NULL, null);\n        } else if (object instanceof String) {\n            return new Pair<>(TYPE_STRING, (String) object);\n        } else if (object instanceof Integer) {\n            return new Pair<>(TYPE_INTEGER, String.valueOf((int) object));\n        } else if (object instanceof Long) {","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/intercept/IntentCompat.java#L243-L279","documentation":"IntentCompat.parseExtraValue() parses boolean extras. When the raw value is not 'true'/'t'/'false'/'f', it falls back to IntegerCompat.decode(); if that also fails (NumberFormatException), it throws IllegalArgumentException('Invalid boolean value: ...').","triggerScenarios":"Providing a TYPE_BOOLEAN extra whose raw string is neither a recognized boolean word nor a decodable integer (e.g. 'yes', 'on', '1.0', empty).","commonSituations":"Hand-editing flattened intent strings; locale/scripting tools writing non-canonical booleans; copy-paste introducing stray characters.","solutions":["Use 'true'/'false' (or 't'/'f', or an integer like 0/1) as the extra value","Sanitize the source producing the value to emit canonical boolean strings","Catch NumberFormatException/IAE at the parse boundary and surface a friendly message"],"exampleFix":"// before\n\"--esb flag yes\"\n// after\n\"--esb flag true\"","handlingStrategy":"validation","validationCode":"if (!(\"true\".equals(v) || \"false\".equals(v) || \"t\".equals(v) || \"f\".equals(v))) {\n    try { IntegerCompat.decode(v); } catch (NumberFormatException e) {\n        throw new IllegalArgumentException(\"Boolean extra must be true/false/t/f or integer: \" + v);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    boolValue = parseBooleanExtra(rawValue);\n} catch (IllegalArgumentException e) {\n    boolValue = false; // or surface a parse error\n}","preventionTips":["Emit booleans as canonical 'true'/'false' in intent strings","Never rely on locale-specific boolean words ('yes'/'on')","Add round-trip tests for every extra type"],"tags":["java","android","intent"],"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-23T08:17:48.524Z"}