{"record":{"id":"a933ecf2c94c2433","repo":"flowable/flowable-engine","slug":"deploymentid-is-null-a933ec","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/SetDeploymentParentDeploymentIdCmd.java","lineNumber":42,"sourceCode":"/**\n * @author Tijs Rademakers\n */\npublic class SetDeploymentParentDeploymentIdCmd implements Command<Void>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String deploymentId;\n    protected String newParentDeploymentId;\n\n    public SetDeploymentParentDeploymentIdCmd(String deploymentId, String newParentDeploymentId) {\n        this.deploymentId = deploymentId;\n        this.newParentDeploymentId = newParentDeploymentId;\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.setParentDeploymentId(newParentDeploymentId);\n\n        CommandContextUtil.getDeploymentEntityManager(commandContext).update(deployment);\n\n        return null;\n\n    }\n\n}","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/SetDeploymentParentDeploymentIdCmd.java#L24-L60","documentation":"SetDeploymentParentDeploymentIdCmd assigns a parent deployment id to a deployment (used for cascading deletes). Its execute method validates that deploymentId is non-null, throwing FlowableIllegalArgumentException ('deploymentId is null') otherwise, before updating entities.","triggerScenarios":"Calling the command executor with new SetDeploymentParentDeploymentIdCmd(null, newParentDeploymentId) or the corresponding management/repository API with a null deployment id.","commonSituations":"Programmatic deployment cleanup scripts where the deployment id variable was never assigned, deletion flows driven by data from a nullable source, or wiring mistakes passing arguments in the wrong order.","solutions":["Pass a valid non-null deployment id fetched via DmnRepositoryService.createDeploymentQuery()","Validate arguments before constructing the command; also verify deployment existence (a null lookup follows this check)","Fix argument ordering / initialization bugs that produced the null id"],"exampleFix":"// before\nmanagementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, parentId));\n// after\nif (deploymentId == null) throw new IllegalArgumentException(\"deploymentId required\");\nmanagementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, parentId));","handlingStrategy":"validation","validationCode":"if (deploymentId == null || deploymentId.isEmpty()) {\n    throw new IllegalArgumentException(\"deploymentId required for parent assignment\");\n}","typeGuard":"boolean canSetParent(String id) { return id != null && !id.isEmpty(); }","tryCatchPattern":"try {\n    managementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, parentId));\n} catch (FlowableIllegalArgumentException e) {\n    log.error(\"Null deploymentId in parent assignment\", e);\n    throw new BadRequestException(\"deploymentId required\");\n}","preventionTips":["Validate constructor arguments before submitting engine commands","Check deployment existence (the command also throws not-found after the null check)","Audit cleanup scripts for nullable id sources"],"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"}