{"record":{"id":"4f4822bd082aaf4e","repo":"MuntashirAkon/AppManager","slug":"invalid-format-isgranted-not-found","errorCode":null,"errorMessage":"Invalid format: isGranted not found","messagePattern":"Invalid format: isGranted not found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/NotificationListenerRule.java","lineNumber":24,"sourceCode":"\nimport java.util.Objects;\nimport java.util.StringTokenizer;\n\nimport io.github.muntashirakon.AppManager.rules.RuleType;\n\npublic class NotificationListenerRule extends RuleEntry {\n    private boolean mIsGranted;\n\n    public NotificationListenerRule(@NonNull String packageName, String name, boolean isGranted) {\n        super(packageName, name, RuleType.NOTIFICATION);\n        this.mIsGranted = isGranted;\n    }\n\n    public NotificationListenerRule(@NonNull String packageName, String name, @NonNull StringTokenizer tokenizer) {\n        super(packageName, name, RuleType.NOTIFICATION);\n        if (tokenizer.hasMoreElements()) {\n            mIsGranted = Boolean.parseBoolean(tokenizer.nextElement().toString());\n        } else throw new IllegalArgumentException(\"Invalid format: isGranted not found\");\n    }\n\n    public boolean isGranted() {\n        return mIsGranted;\n    }\n\n    public void setGranted(boolean granted) {\n        mIsGranted = granted;\n    }\n\n    @NonNull\n    @Override\n    public String toString() {\n        return \"NotificationListenerRule{\" +\n                \"packageName='\" + packageName + '\\'' +\n                \", name='\" + name + '\\'' +\n                \", isGranted=\" + mIsGranted +\n                '}';","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/NotificationListenerRule.java#L6-L42","documentation":"NotificationListenerRule's constructor reads the isGranted boolean from the flattened rule string. If the tokenizer is exhausted, it throws this IllegalArgumentException because a NOTIFICATION rule requires the isGranted field to know whether listener access is granted.","triggerScenarios":"new NotificationListenerRule(packageName, name, tokenizer) called with no tokens remaining after the name, i.e. the flattened string stops at the component name.","commonSituations":"Truncated rules exports, manually trimmed lines, or parsing with a wrong delimiter so the boolean token merges or disappears.","solutions":["Append a \"true\"/\"false\" isGranted token to the flattened rule string","Validate token count before constructing the rule","Re-export rules from the current version to restore missing fields","Try-catch the parse and skip malformed notification rules"],"exampleFix":"// before\nnew NotificationListenerRule(pkg, \"cmp\", new StringTokenizer(\"com.example\\tcmp\")); // throws\n// after\nnew NotificationListenerRule(pkg, \"cmp\", new StringTokenizer(\"com.example\\tcmp\\ttrue\"));","handlingStrategy":"try-catch","validationCode":"String[] p = line.split(\"\\t\");\nif (p.length < 3) throw new IllegalArgumentException(\"NOTIFICATION rule needs isGranted\");\nBoolean.parseBoolean(p[2]);","typeGuard":"boolean isParsableNotificationRule(String line) { String[] p = line.split(\"\\t\"); return p.length >= 3 && (p[2].equals(\"true\") || p[2].equals(\"false\")); }","tryCatchPattern":"try { new NotificationListenerRule(pkg, name, tokenizer); } catch (IllegalArgumentException e) { log.warn(\"Bad notification rule: \" + line); }","preventionTips":["Ensure the flattened order: package, component name, isGranted","Count tokens before constructing the rule","Skip blank/truncated lines when batch-importing rules files"],"tags":["rules-parsing","notification","illegal-argument"],"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-23T08:17:48.524Z"}