{"record":{"id":"36e69435723a7a3a","repo":"flowable/flowable-engine","slug":"deploymentid-is-null-36e694","errorCode":null,"errorMessage":"deploymentId is null","messagePattern":"deploymentId is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/SetDeploymentTenantIdCmd.java","lineNumber":45,"sourceCode":"/**\n * @author Joram Barrez\n */\npublic class SetDeploymentTenantIdCmd implements Command<Void>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String deploymentId;\n    protected String newTenantId;\n\n    public SetDeploymentTenantIdCmd(String deploymentId, String newTenantId) {\n        this.deploymentId = deploymentId;\n        this.newTenantId = newTenantId;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        if (deploymentId == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentId is null\");\n        }\n\n        // Update all entities\n\n        DmnDeploymentEntity deployment = CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId);\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find deployment with id \" + deploymentId);\n        }\n\n        deployment.setTenantId(newTenantId);\n\n        // Doing process instances, executions and tasks with direct SQL updates\n        // (otherwise would not be performant)\n        CommandContextUtil.getDecisionEntityManager(commandContext).updateDecisionTenantIdForDeployment(deploymentId, newTenantId);\n\n        // Doing decision tables in memory, cause we need to clear the decision table cache\n        List<DmnDecision> decisionTables = new DecisionQueryImpl().deploymentId(deploymentId).list();\n        for (DmnDecision decisionTable : decisionTables) {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/SetDeploymentTenantIdCmd.java#L27-L63","documentation":"SetDeploymentTenantIdCmd.execute validates its deploymentId argument up front and throws FlowableIllegalArgumentException when it is null. The command refuses to run a tenant-id update that could never resolve to a deployment.","triggerScenarios":"Constructing SetDeploymentTenantIdCmd with a null deploymentId — typically because the caller's own id variable was never set, or a lookup that returned null was passed straight through.","commonSituations":"Chaining deployment.getId() from an object that was null; refactoring that removed id assignment; programmatic command execution where arguments come from config or request parameters that were absent.","solutions":["Check deploymentId for null/blank before constructing or executing the command.","Ensure the id source (query result, config, request) is validated at the caller boundary.","Catch FlowableIllegalArgumentException to surface a clear client-side validation error."],"exampleFix":"// before\nmanagementService.executeCommand(new SetDeploymentTenantIdCmd(deploymentId, tenantId));\n// after\nObjects.requireNonNull(deploymentId, \"deploymentId must be set\");\nmanagementService.executeCommand(new SetDeploymentTenantIdCmd(deploymentId, tenantId));","handlingStrategy":"validation","validationCode":"if (deploymentId == null || deploymentId.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"deploymentId must be non-empty\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    dmnManagementService.executeCommand(new SetDeploymentTenantIdCmd(deploymentId, tenantId));\n} catch (FlowableIllegalArgumentException e) {\n    log.error(\"Invalid argument for tenant update\", e);\n}","preventionTips":["Validate ids at the API boundary before command execution","Don't pass through results of lookups that may return null","Use Objects.requireNonNull on id fields in service wrappers"],"tags":["flowable","dmn","null-argument","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-14T11:17:12.474Z"}