{"record":{"id":"a641352202fe4fb4","repo":"flowable/flowable-engine","slug":"deploymentid-is-null-a64135","errorCode":null,"errorMessage":"deploymentId is null","messagePattern":"deploymentId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetDeploymentResourceCmd.java","lineNumber":43,"sourceCode":"\n/**\n * @author Joram Barrez\n */\npublic class GetDeploymentResourceCmd implements Command<InputStream>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String deploymentId;\n    protected String resourceName;\n\n    public GetDeploymentResourceCmd(String deploymentId, String resourceName) {\n        this.deploymentId = deploymentId;\n        this.resourceName = resourceName;\n    }\n\n    @Override\n    public InputStream execute(CommandContext commandContext) {\n        if (deploymentId == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentId is null\");\n        }\n        if (resourceName == null) {\n            throw new FlowableIllegalArgumentException(\"resourceName is null\");\n        }\n\n        EventResourceEntity resource = CommandContextUtil.getResourceEntityManager().findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);\n        if (resource == null) {\n            if (CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId) == null) {\n                throw new FlowableObjectNotFoundException(\"deployment does not exist: \" + deploymentId);\n            } else {\n                throw new FlowableObjectNotFoundException(\"no resource found with name '\" + resourceName + \"' in deployment '\" + deploymentId + \"'\");\n            }\n        }\n        return new ByteArrayInputStream(resource.getBytes());\n    }\n\n}\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetDeploymentResourceCmd.java#L25-L61","documentation":"GetDeploymentResourceCmd streams a resource (e.g. an event model XML) from a deployed event deployment. If deploymentId is null the command cannot locate anything and throws FlowableIllegalArgumentException immediately before any lookup. It protects the resource entity manager from a pointless null-keyed query.","triggerScenarios":"Executing GetDeploymentResourceCmd(null, resourceName) directly, or via the behavior layer (executeActivityBehavior) where the deploymentId was resolved from a null deployment property.","commonSituations":"Programmatic deployment resource fetch where the deployment id variable was never populated; process/config model that omitted the deployment reference; result of a failed deploy call whose returned id was ignored.","solutions":["Pass a valid deploymentId obtained from the EventDeployment returned by repositoryService/EventRepositoryService.createDeployment().deploy()","Guard the caller: only execute the command when deploymentId != null","Trace where the null id originates (e.g. executeActivityBehavior) and fix the upstream resolution"],"exampleFix":"// before\nInputStream is = managementService.executeCommand(new GetDeploymentResourceCmd(deploymentId, \"my.model.json\")); // deploymentId null\n// after\nif (deploymentId == null) {\n    throw new IllegalStateException(\"deploymentId must be resolved before fetching resources\");\n}\nInputStream is = managementService.executeCommand(new GetDeploymentResourceCmd(deploymentId, \"my.model.json\"));","handlingStrategy":"validation","validationCode":"if (deploymentId == null || deploymentId.isEmpty()) {\n    throw new IllegalArgumentException(\"deploymentId required\");\n}","typeGuard":"boolean hasDeploymentId = deploymentId != null && !deploymentId.trim().isEmpty();","tryCatchPattern":"try {\n    InputStream is = cmd.execute(commandContext);\n} catch (FlowableIllegalArgumentException e) {\n    log.error(\"Missing deploymentId: {}\", e.getMessage());\n}","preventionTips":["Capture the id returned by deploy() immediately","Never re-resolve deployment ids from mutable state","Null-check ids at API boundaries"],"tags":["flowable","event-registry","null-argument","deployment"],"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"}