{"record":{"id":"1f3120e379f0c943","repo":"flowable/flowable-engine","slug":"dmn-bytes-is-null","errorCode":null,"errorMessage":"dmn bytes is null","messagePattern":"dmn bytes 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":107,"sourceCode":"    }\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);\n        deployment.addResource(resource);\n        return this;\n    }\n\n    @Override\n    public DmnDeploymentBuilder addDmnModel(String resourceName, DmnDefinition dmnDefinition) {\n        DmnXMLConverter dmnXMLConverter = new DmnXMLConverter();\n        String dmn20Xml = new String(dmnXMLConverter.convertToXML(dmnDefinition), StandardCharsets.UTF_8);\n        addString(resourceName, dmn20Xml);\n        return this;\n    }\n\n    @Override","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java#L89-L125","documentation":"DmnDeploymentBuilderImpl.addDmnBytes registers raw DMN bytes as a deployment resource and throws FlowableException('dmn bytes is null') when the byte array argument is null. Like addString, it is an argument-validation guard preventing a DmnResourceEntity from being persisted with null content.","triggerScenarios":"Calling addDmnBytes(resourceName, dmnBytes) with a null byte[] — typically when bytes came from a failed file read (readAllBytes on missing file), a null-valued HTTP response body, a stream conversion that produced null, or an unset variable holding the DMN content.","commonSituations":"Downloading DMN definitions from a remote service that returned no body, reading files from a directory that does not exist, deserialization utilities returning null on failure, or templating pipelines where a prior step silently failed to produce content.","solutions":["Verify the byte[] is non-null (and ideally non-empty) before calling addDmnBytes; throw a descriptive error at the call site.","Trace where the bytes are produced and fix the upstream producer (file read, HTTP download, converter).","Prefer addInputStream or addClasspathResource for file-backed content so the engine handles the I/O and its errors explicitly."],"exampleFix":"// before\nbyte[] dmnBytes = fetchDmnBytes(id); // may return null\nrepositoryService.createDeployment().addDmnBytes(\"decision.dmn\", dmnBytes);\n// after\nbyte[] dmnBytes = fetchDmnBytes(id);\nif (dmnBytes == null || dmnBytes.length == 0) {\n    throw new IllegalStateException(\"No DMN content fetched for id \" + id);\n}\nrepositoryService.createDeployment().addDmnBytes(\"decision.dmn\", dmnBytes);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(dmnBytes, \"DMN bytes must not be null\");\nif (dmnBytes.length == 0) {\n    throw new IllegalArgumentException(\"DMN bytes must not be empty\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    builder.addDmnBytes(\"decision.dmn\", dmnBytes);\n} catch (FlowableException e) {\n    if (\"dmn bytes is null\".equals(e.getMessage())) {\n        throw new IllegalArgumentException(\"Supplied DMN bytes were null\", e);\n    }\n    throw e;\n}","preventionTips":["Guarantee the byte producer (file read, HTTP fetch) throws on failure instead of returning null.","Check both null and length == 0 before passing content to the builder.","Wrap I/O in try-with-resources so partial reads surface as errors, not silent nulls."],"tags":["java","flowable","null-argument","bytes","deployment"],"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"}