{"record":{"id":"8146cc3b9d79a44d","repo":"flowable/flowable-engine","slug":"text-is-null-8146cc","errorCode":null,"errorMessage":"text is null","messagePattern":"text is null","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java","lineNumber":94,"sourceCode":"    }\n\n    @Override\n    public DmnDeploymentBuilder 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 DmnDeploymentBuilder addString(String resourceName, String text) {\n        if (text == null) {\n            throw new FlowableException(\"text is null\");\n        }\n\n        DmnResourceEntity 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 DmnDeploymentBuilder addDmnBytes(String resourceName, byte[] dmnBytes) {\n        if (dmnBytes == null) {\n            throw new FlowableException(\"dmn bytes is null\");\n        }\n\n        DmnResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(dmnBytes);","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java#L76-L112","documentation":"DmnDeploymentBuilderImpl.addString registers an in-memory String as a deployment resource. A FlowableException('text is null') is thrown as a defensive argument check when the caller passes null text, since the builder would otherwise store null bytes on the DmnResourceEntity. It is a fast-fail validation guard, not a state error.","triggerScenarios":"Calling addString(resourceName, text) with a null second argument, directly or indirectly — including via addDmnModel when the model-to-string conversion (e.g. DmnXMLConverter.convertToDmnXML returning null) produces a null string.","commonSituations":"Converting a DmnModel to XML with a converter that returns null for an empty/uninitialized model, loading the DMN content from a config/property/env value that is missing and defaults to null, or dynamically generated DMN text where an upstream builder silently produced null.","solutions":["Ensure the String passed to addString is non-null before calling; validate or fail fast at the call site.","If using addDmnModel, check that the DmnModel is properly initialized and the XML conversion returns a non-empty string.","Fix the source of the null: missing config value, failed file read, or unpopulated variable that should contain the DMN XML."],"exampleFix":"// before\nString dmnXml = config.getDmnXml(); // may be null\nrepositoryService.createDeployment().addString(\"decision.dmn\", dmnXml);\n// after\nString dmnXml = config.getDmnXml();\nif (dmnXml == null || dmnXml.isEmpty()) {\n    throw new IllegalArgumentException(\"dmnXml configuration is missing\");\n}\nrepositoryService.createDeployment().addString(\"decision.dmn\", dmnXml);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(dmnXml, \"DMN XML text must not be null\");\nif (dmnXml.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"DMN XML text must not be empty\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    builder.addString(\"decision.dmn\", dmnXml);\n} catch (FlowableException e) {\n    if (\"text is null\".equals(e.getMessage())) {\n        throw new IllegalArgumentException(\"Supplied DMN text was null\", e);\n    }\n    throw e;\n}","preventionTips":["Null-check content at the point it is produced, not at the API call.","Make null content fail fast in the configuration loader that supplies the DMN XML.","Prefer Optional<String> or explicit null returns for DMN XML producers so callers are forced to handle absence."],"tags":["java","flowable","null-argument","deployment","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-14T05:17:10.506Z"}