{"record":{"id":"956bec1c54eb90bd","repo":"MyCATApache/Mycat-Server","slug":"name-is-null","errorCode":null,"errorMessage":"name is null","messagePattern":"name is null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/config/model/rule/TableRuleConfig.java","lineNumber":37,"sourceCode":" * \n * Any questions about this component can be directed to it's project Web address \n * https://code.google.com/p/opencloudb/.\n *\n */\npackage io.mycat.config.model.rule;\n\nimport java.io.Serializable;\n\n/**\n * @author mycat\n */\npublic class TableRuleConfig implements Serializable {\n    private  String name;\n    private final RuleConfig rule;\n\n    public TableRuleConfig(String name, RuleConfig rule) {\n        if (name == null) {\n            throw new IllegalArgumentException(\"name is null\");\n        }\n        this.name = name;\n        if (rule == null) {\n            throw new IllegalArgumentException(\"no rule is found\");\n        }\n        this.rule =rule;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    /**\n     * @return unmodifiable","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/config/model/rule/TableRuleConfig.java#L19-L55","documentation":"TableRuleConfig's constructor requires a non-null name for the table rule; if name is null it throws IllegalArgumentException(\"name is null\"). The name is how <table> elements reference the rule via their rule attribute, so it must be present. (A subsequent check also rejects a null RuleConfig.)","triggerScenarios":"new TableRuleConfig(null, rule) or rule.xml parsing where a <tableRule> element has no name attribute.","commonSituations":"rule.xml tableRule element missing the name attribute; programmatic construction with null name; XML attribute loading failure returning null.","solutions":["Add name=\"<ruleName>\" to the <tableRule> element in rule.xml.","Ensure the name matches the rule attribute used by tables in schema.xml.","If constructing programmatically, pass a non-null name string."],"exampleFix":"// before (rule.xml)\n<tableRule><rule><columns>id</columns><function>mod-long</function></rule></tableRule>\n// after\n<tableRule name=\"order-rule\"><rule><columns>id</columns><function>mod-long</function></rule></tableRule>","handlingStrategy":"validation","validationCode":"if (ruleName == null || ruleName.isEmpty()) throw new IllegalArgumentException(\"tableRule name attribute required\");","typeGuard":null,"tryCatchPattern":"try { new TableRuleConfig(name, rule); } catch (IllegalArgumentException e) { if (\"name is null\".equals(e.getMessage())) { LOG.error(\"tableRule missing name attr\"); } throw e; }","preventionTips":["Every <tableRule> in rule.xml needs a unique name attribute.","Ensure schema.xml rule attributes reference these names exactly.","Validate rule.xml before startup and in CI."],"tags":["config","mycat","rule","null-argument"],"backgroundTag":"null-argument","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}