{"record":{"id":"c3361f2acb198d92","repo":"flowable/flowable-engine","slug":"resourcename-is-null-c3361f","errorCode":null,"errorMessage":"resourceName is null","messagePattern":"resourceName is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetDeploymentResourceCmd.java","lineNumber":46,"sourceCode":" */\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 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().findDeploymentById(deploymentId) == null) {\n                throw new ActivitiObjectNotFoundException(\"deployment does not exist: \" + deploymentId, Deployment.class);\n            } else {\n                throw new ActivitiObjectNotFoundException(\"no resource found with name '\" + resourceName + \"' in deployment '\" + deploymentId + \"'\", InputStream.class);\n            }\n        }\n        return new ByteArrayInputStream(resource.getBytes());\n    }\n\n}\n","sourceCodeStart":28,"sourceCodeEnd":63,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetDeploymentResourceCmd.java#L28-L63","documentation":"GetDeploymentResourceCmd.execute validates resourceName and throws ActivitiIllegalArgumentException when it is null. Resources inside a deployment are addressed by name, so a null name cannot be resolved.","triggerScenarios":"repositoryService.getResourceAsStream(deploymentId, resourceName) with a null resourceName.","commonSituations":"Resource name read from properties/env that was missing; typo in configuration key; building the name dynamically (e.g. process key + \".bpmn20.xml\") when the key is null.","solutions":["Pass the exact resource name as it was added with addInputStream/addClasspathResource during deployment.","Null-check resourceName before the call, or default it to a known constant like \"process.bpmn20.xml\".","List actual names via repositoryService.getDeploymentResourceNames(deploymentId) and use one of them."],"exampleFix":"// before\nInputStream is = repositoryService.getResourceAsStream(deploymentId, resourceName);\n// after\nif (resourceName == null) {\n    resourceName = deploymentId != null\n        ? repositoryService.getDeploymentResourceNames(deploymentId).iterator().next()\n        : \"process.bpmn20.xml\";\n}\nInputStream is = repositoryService.getResourceAsStream(deploymentId, resourceName);","handlingStrategy":"validation","validationCode":"if (resourceName == null || resourceName.isEmpty()) {\n    throw new IllegalArgumentException(\"resourceName must be provided\");\n}","typeGuard":"boolean hasResourceName(String name) { return name != null && !name.isEmpty(); }","tryCatchPattern":"try {\n    return repositoryService.getResourceAsStream(deploymentId, resourceName);\n} catch (ActivitiIllegalArgumentException e) {\n    log.error(\"Null resourceName passed to getResourceAsStream\", e);\n    return null;\n}","preventionTips":["Keep resource names in a shared constants class.","Verify configured names against getDeploymentResourceNames() in integration tests."],"tags":["deployment","null-argument","resource-name"],"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"}