{"record":{"id":"09f4975724f97d8b","repo":"Activiti/Activiti","slug":"entityclass-is-null","errorCode":null,"errorMessage":"entityClass is null","messagePattern":"entityClass is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetTableNameCmd.java","lineNumber":35,"sourceCode":"\nimport java.io.Serializable;\nimport org.activiti.engine.ActivitiIllegalArgumentException;\nimport org.activiti.engine.impl.interceptor.Command;\nimport org.activiti.engine.impl.interceptor.CommandContext;\n\npublic class GetTableNameCmd implements Command<String>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    private Class<?> entityClass;\n\n    public GetTableNameCmd(Class<?> entityClass) {\n        this.entityClass = entityClass;\n    }\n\n    public String execute(CommandContext commandContext) {\n        if (entityClass == null) {\n            throw new ActivitiIllegalArgumentException(\"entityClass is null\");\n        }\n        return commandContext.getTableDataManager().getTableName(entityClass, true);\n    }\n}\n","sourceCodeStart":17,"sourceCodeEnd":40,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetTableNameCmd.java#L17-L40","documentation":"Thrown by GetTableNameCmd.execute when entityClass is null. The command validates the argument with ActivitiIllegalArgumentException before asking TableDataManager.getTableName(entityClass, true) to map the entity class to its physical table name.","triggerScenarios":"Calling managementService.getTableName(null), or passing a Class variable resolved reflectively where resolution failed and returned null.","commonSituations":"Reflection-based lookup that failed silently; generic helper receiving a null Class; confusion between entity class and DTO class.","solutions":["Null-check entityClass before the call.","Pass one of Activiti's entity classes/interfaces documented for ManagementService.getTableName.","Handle Class.forName failures explicitly instead of letting null propagate."],"exampleFix":"// before\nString table = managementService.getTableName(entityClass);\n// after\nif (entityClass == null) throw new IllegalArgumentException(\"entityClass is required\");\nString table = managementService.getTableName(entityClass);","handlingStrategy":"validation","validationCode":"if (entityClass == null) throw new IllegalArgumentException(\"entityClass is required\");","typeGuard":"boolean isValidEntityClass(Class<?> c) {\n    return c != null;\n}","tryCatchPattern":null,"preventionTips":["Pass Activiti entity interfaces/classes explicitly.","Fail fast on Class.forName errors instead of propagating null.","Don't confuse DTOs with engine entity classes."],"tags":["activiti","null-argument","database","validation"],"backgroundTag":"null-argument","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}