{"record":{"id":"5fa3295d8a6c3abd","repo":"flowable/flowable-engine","slug":"text-is-null-5fa329","errorCode":null,"errorMessage":"text is null","messagePattern":"text is null","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java","lineNumber":89,"sourceCode":"    }\n\n    @Override\n    public CmmnDeploymentBuilder 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 CmmnDeploymentBuilder addString(String resourceName, String text) {\n        if (text == null) {\n            throw new FlowableException(\"text is null\");\n        }\n\n        CmmnResourceEntity 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 CmmnDeploymentBuilder addBytes(String resourceName, byte[] bytes) {\n        if (bytes == null) {\n            throw new FlowableException(\"bytes array is null\");\n        }\n\n        CmmnResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(bytes);","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java#L71-L107","documentation":"FlowableException thrown by CmmnDeploymentBuilderImpl.addString when the text parameter is null. The builder requires non-null content because it immediately encodes the text to UTF-8 bytes as a deployment resource. It is a fail-fast argument validation error.","triggerScenarios":"Calling cmmnRepositoryService.createDeployment().addString(resourceName, null), or passing a variable that was expected to hold the model XML but resolved to null (e.g. failed file read, unmapped config value).","commonSituations":"Programmatically generating CMMN XML where the generator returned null, loading model content from a database/config that returned null, refactoring that dropped an assignment before the addString call.","solutions":["Ensure the String passed to addString is non-null before calling","Check the upstream producer of the XML string (file read, DB query, generator) for null returns","Default or fail early in your own code with a clearer message","Use addBytes/addInputStream instead if you truly have byte content, not text"],"exampleFix":"// before\nbuilder.addString(\"model.cmmn.xml\", loadModelXml()); // may return null\n// after\nString xml = loadModelXml();\nif (xml == null) { throw new IllegalStateException(\"CMMN model XML not loaded\"); }\nbuilder.addString(\"model.cmmn.xml\", xml);","handlingStrategy":"validation","validationCode":"if (text == null || text.trim().isEmpty()) { throw new IllegalArgumentException(\"CMMN model text must be non-empty\"); }","typeGuard":"static boolean isValidModelText(String text) { return text != null && !text.trim().isEmpty(); }","tryCatchPattern":"try {\n    builder.addString(resourceName, text);\n} catch (FlowableException e) {\n    if (\"text is null\".equals(e.getMessage())) {\n        throw new IllegalArgumentException(\"Model XML for \" + resourceName + \" was null\", e);\n    }\n    throw e;\n}","preventionTips":["Wrap loaders (file/DB) so they throw instead of returning null","Use Objects.requireNonNull at the point the model string is produced","Assert non-null in tests for all programmatically generated models","Fail at configuration load time, not deployment time"],"tags":["null-check","argument-validation","deployment","cmmn"],"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"}