{"record":{"id":"85280dcca7c05045","repo":"flowable/flowable-engine","slug":"entityclass-is-null","errorCode":null,"errorMessage":"entityClass is null","messagePattern":"entityClass is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/GetTableNameCmd.java","lineNumber":37,"sourceCode":"import org.flowable.common.engine.api.FlowableIllegalArgumentException;\nimport org.flowable.common.engine.impl.interceptor.Command;\nimport org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.dmn.engine.impl.db.EntityToTableMap;\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    @Override\n    public String execute(CommandContext commandContext) {\n        if (entityClass == null) {\n            throw new FlowableIllegalArgumentException(\"entityClass is null\");\n        }\n        String databaseTablePrefix = getDbSqlSession(commandContext).getDbSqlSessionFactory().getDatabaseTablePrefix();\n        String tableName = EntityToTableMap.getTableName(entityClass);\n\n        return databaseTablePrefix + tableName;\n    }\n\n}\n","sourceCodeStart":19,"sourceCodeEnd":46,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/GetTableNameCmd.java#L19-L46","documentation":"GetTableNameCmd maps an entity class to its database table name using EntityToTableMap and prepends the configured database table prefix. It throws FlowableIllegalArgumentException when the entityClass parameter is null, because a null class cannot be mapped to a table.","triggerScenarios":"Calling DmnManagementService.getTableName(null) or building new GetTableNameCmd(null).","commonSituations":"Reflection code that resolved the entity Class dynamically and got null, generics erased to a null Class token, or passing a non-entity type through a generic helper.","solutions":["Pass the entity class literal, e.g. dmnManagementService.getTableName(HistoricDecisionExecutionEntityImpl.class)","Fix the reflection/generic code that produced a null Class","Verify the class passed is a DMN engine entity known to EntityToTableMap"],"exampleFix":"// before\nString table = managementService.getTableName(entityClass); // entityClass may be null\n// after\nif (entityClass == null) {\n    entityClass = HistoricDecisionExecutionEntityImpl.class;\n}\nString table = managementService.getTableName(entityClass);","handlingStrategy":"type-guard","validationCode":"if (entityClass == null) {\n    throw new IllegalArgumentException(\"entityClass required\");\n}","typeGuard":"boolean isEntityClass(Class<?> c) { return c != null && EntityToTableMap.getTableName(c) != null; }","tryCatchPattern":"try {\n    table = managementService.getTableName(entityClass);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"getTableName called with null class\");\n    table = null;\n}","preventionTips":["Pass class literals directly instead of reflective Class resolution that can yield null","Default to a known entity class when generics erase to null","Keep a map of supported entity classes in your own code"],"tags":["java","flowable-dmn","null-check","validation"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}