{"record":{"id":"8040dbd0dc08b73c","repo":"flowable/flowable-engine","slug":"text-is-null-8040db","errorCode":null,"errorMessage":"text is null","messagePattern":"text is null","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java","lineNumber":91,"sourceCode":"    }\n\n    @Override\n    public EventDeploymentBuilder addClasspathResource(String resource) {\n        try (final InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(resource)) {\n            if (inputStream == null) {\n                throw new FlowableException(\"resource '\" + resource + \"' not found\");\n            }\n            return addInputStream(resource, inputStream);\n            \n        } catch (IOException ex) {\n            throw new FlowableException(\"Failed to read resource \" + resource, ex);\n        }\n    }\n\n    @Override\n    public EventDeploymentBuilder addString(String resourceName, String text) {\n        if (text == null) {\n            throw new FlowableException(\"text is null\");\n        }\n\n        EventResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(text.getBytes(StandardCharsets.UTF_8));\n        deployment.addResource(resource);\n        return this;\n    }\n\n    @Override\n    public EventDeploymentBuilder addEventDefinitionBytes(String resourceName, byte[] eventDefinitionBytes) {\n        if (eventDefinitionBytes == null) {\n            throw new FlowableException(\"event definition bytes is null\");\n        }\n\n        EventResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(eventDefinitionBytes);","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java#L73-L109","documentation":"FlowableException thrown by EventDeploymentBuilderImpl.addString when the text argument is null. addString stores an in-memory string resource (e.g. an event or channel XML definition) as UTF-8 bytes in the deployment, which cannot hold a null payload.","triggerScenarios":"Calling deploymentBuilder.addString(resourceName, text) with text == null; e.g. passing a null String returned from a config lookup or template renderer.","commonSituations":"XML definition loaded from a property/environment variable that is unset; a template engine returning null; refactored code that lost a default value.","solutions":["Ensure the definition string is non-null before calling addString.","Check the source of the text (config, env var, file) and provide a default.","If the resource is byte-based, use addEventDefinitionBytes/addChannelDefinitionBytes with valid bytes instead."],"exampleFix":"// before\nString xml = config.get(\"order.event.xml\");\nbuilder.addString(\"order.event\", xml);\n// after\nString xml = config.getOrDefault(\"order.event.xml\", DEFAULT_ORDER_EVENT_XML);\nObjects.requireNonNull(xml, \"order event xml must be set\");\nbuilder.addString(\"order.event\", xml);","handlingStrategy":"validation","validationCode":"if (text == null || text.isEmpty()) { throw new IllegalArgumentException(\"definition text for \" + resourceName + \" must be non-empty\"); }","typeGuard":"boolean ok = text instanceof String s && !s.isEmpty();","tryCatchPattern":"try { builder.addString(name, text); } catch (FlowableException e) { LOG.error(\"null definition text for \" + name); throw e; }","preventionTips":["Use Objects.requireNonNull on definition strings before deployment","Fail fast when config/env lookups return null","Prefer addInputStream/addClasspathResource for file-based definitions"],"tags":["flowable","deployment","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"}