{"record":{"id":"7cd8bc2e79f71f2e","repo":"MuntashirAkon/AppManager","slug":"invalid-format-freeze-type-not-found","errorCode":null,"errorMessage":"Invalid format: freeze_type not found","messagePattern":"Invalid format: freeze_type not found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/FreezeRule.java","lineNumber":26,"sourceCode":"import java.util.StringTokenizer;\n\nimport io.github.muntashirakon.AppManager.rules.RuleType;\nimport io.github.muntashirakon.AppManager.utils.FreezeUtils;\n\npublic class FreezeRule extends RuleEntry {\n    @FreezeUtils.FreezeMethod\n    private int mFreezeType;\n\n    public FreezeRule(@NonNull String packageName, @FreezeUtils.FreezeMethod int freezeType) {\n        super(packageName, STUB, RuleType.FREEZE);\n        mFreezeType = freezeType;\n    }\n\n    public FreezeRule(@NonNull String packageName, @NonNull StringTokenizer tokenizer) {\n        super(packageName, STUB, RuleType.FREEZE);\n        if (tokenizer.hasMoreElements()) {\n            mFreezeType = Integer.parseInt(tokenizer.nextElement().toString());\n        } else throw new IllegalArgumentException(\"Invalid format: freeze_type not found\");\n    }\n\n    public int getFreezeType() {\n        return mFreezeType;\n    }\n\n    public void setFreezeType(@FreezeUtils.FreezeMethod int freezeType) {\n        mFreezeType = freezeType;\n    }\n\n    @NonNull\n    @Override\n    public String toString() {\n        return \"FreezeRule{\" +\n                \"mFreezeType=\" + mFreezeType +\n                \", packageName='\" + packageName + '\\'' +\n                '}';\n    }","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/FreezeRule.java#L8-L44","documentation":"FreezeRule's constructor parses the freeze_type token from a flattened rule string. If the StringTokenizer is exhausted before the freeze type is present, it throws this IllegalArgumentException. It means the rule line is truncated or malformed relative to the expected FREEZE rule format.","triggerScenarios":"Calling new FreezeRule(packageName, tokenizer) with a tokenizer that has no remaining tokens after the constructor's super() consumes the package name, e.g. parsing a flattened string with only one field.","commonSituations":"Hand-edited or truncated rules.txt / external rules import files, older export formats missing the freeze_type field, or splitting a flattened string with the wrong delimiter so tokens are lost.","solutions":["Ensure the flattened rule string for a FREEZE rule contains a numeric freeze_type token after the package name","Validate token count (>=2 for the tokenizer passed in) before constructing FreezeRule","Re-export the rules file from a matching AppManager version to get the correct field order","Wrap rule parsing in try-catch for IllegalArgumentException and skip/log the malformed line"],"exampleFix":"// before\nStringTokenizer st = new StringTokenizer(\"com.example.app\");\nFreezeRule r = new FreezeRule(\"com.example.app\", st); // throws\n// after\nStringTokenizer st = new StringTokenizer(\"com.example.app\\t1\");\nFreezeRule r = new FreezeRule(\"com.example.app\", st); // freeze_type=1","handlingStrategy":"try-catch","validationCode":"String[] parts = ruleLine.split(\"\\t\");\nif (parts.length < 2) throw new IllegalArgumentException(\"FREEZE rule needs freeze_type\");\nInteger.parseInt(parts[1]);","typeGuard":"boolean isParsableFreezeRule(String line) { String[] p = line.split(\"\\t\"); return p.length >= 2 && p[1].matches(\"\\\\d+\"); }","tryCatchPattern":"try { new FreezeRule(pkg, tokenizer); } catch (IllegalArgumentException e) { log.warn(\"Skipping malformed FREEZE rule: \" + ruleLine, e); }","preventionTips":["Never hand-edit flattened rule strings; regenerate via AppManager export","Validate token counts against the expected field layout before parsing","Keep imports tolerant: catch IllegalArgumentException per line and continue"],"tags":["rules-parsing","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"}