{"record":{"id":"79500880add82f73","repo":"Activiti/Activiti","slug":"deploymentid-is-null-795008","errorCode":null,"errorMessage":"deploymentId is null","messagePattern":"deploymentId is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetDeploymentResourceCmd.java","lineNumber":44,"sourceCode":"import org.activiti.engine.repository.Deployment;\n\n/**\n\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    public InputStream execute(CommandContext commandContext) {\n        if (deploymentId == null) {\n            throw new ActivitiIllegalArgumentException(\"deploymentId is null\");\n        }\n        if (resourceName == null) {\n            throw new ActivitiIllegalArgumentException(\"resourceName is null\");\n        }\n\n        ResourceEntity resource = commandContext\n            .getResourceEntityManager()\n            .findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);\n        if (resource == null) {\n            if (commandContext.getDeploymentEntityManager().findById(deploymentId) == null) {\n                throw new ActivitiObjectNotFoundException(\n                    \"deployment does not exist: \" + deploymentId,\n                    Deployment.class\n                );\n            } else {\n                throw new ActivitiObjectNotFoundException(\n                    \"no resource found with name '\" + resourceName + \"' in deployment '\" + deploymentId + \"'\",\n                    InputStream.class","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetDeploymentResourceCmd.java#L26-L62","documentation":"GetDeploymentResourceCmd.execute() validates its inputs before querying the resource entity manager. The deploymentId is required to look up a deployed resource, so a null id cannot be resolved and the command throws ActivitiIllegalArgumentException immediately. This is a fail-fast guard: no database lookup is attempted.","triggerScenarios":"Calling RepositoryService.getDeploymentResourceNames(null)... actually the resource variant: repositoryService.getResourceAsStream(null, \"resourceName\") or new GetDeploymentResourceCmd(null, name) executed via the command executor, passing a null deploymentId.","commonSituations":"A deployment id variable that was never assigned (e.g. a method returned null because deployment creation was skipped or failed), a config property like process.deployment.id left unset, or mapping a nullable entity field straight into the API call.","solutions":["Ensure the deploymentId passed to getResourceAsStream(deploymentId, resourceName) is a non-null string obtained from a successful deployment (deployment.getId()).","Check the calling code for a variable that is null because an earlier deployment/query call returned null, and handle that null before invoking the command.","If the id comes from configuration, validate it at startup with a clear failure message instead of passing null downstream."],"exampleFix":"// before\nInputStream is = repositoryService.getResourceAsStream(deploymentId, \"diagram.png\");\n// after\nif (deploymentId == null) {\n    throw new IllegalStateException(\"deploymentId not set; was the deployment created?\");\n}\nInputStream is = repositoryService.getResourceAsStream(deploymentId, \"diagram.png\");","handlingStrategy":"validation","validationCode":"if (deploymentId == null || deploymentId.isEmpty()) {\n    throw new IllegalArgumentException(\"deploymentId required before getResourceAsStream\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    InputStream is = repositoryService.getResourceAsStream(deploymentId, name);\n} catch (ActivitiIllegalArgumentException e) {\n    // deploymentId was null; recover by re-resolving the deployment\n}","preventionTips":["Always source deployment ids from the Deployment object returned by deploy().","Assert non-null inputs at service boundaries before calling repository APIs.","Fail fast at configuration load time if a deployment id property is blank."],"tags":["null-argument","repository-service","deployment","illegal-argument"],"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"}