{"record":{"id":"4824887b3498fc66","repo":"flowable/flowable-engine","slug":"bytes-array-is-null","errorCode":null,"errorMessage":"bytes array is null","messagePattern":"bytes array is null","errorType":"validation","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java","lineNumber":102,"sourceCode":"    }\n\n    @Override\n    public AppDeploymentBuilder addString(String resourceName, String text) {\n        if (text == null) {\n            throw new FlowableException(\"text is null\");\n        }\n\n        AppResourceEntity 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 AppDeploymentBuilder addBytes(String resourceName, byte[] bytes) {\n        if (bytes == null) {\n            throw new FlowableException(\"bytes array is null\");\n        }\n\n        AppResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(bytes);\n        deployment.addResource(resource);\n        return this;\n    }\n    \n    @Override\n    public AppDeploymentBuilder addZipInputStream(ZipInputStream zipInputStream) {\n        try {\n            ZipEntry entry = zipInputStream.getNextEntry();\n            while (entry != null) {\n                if (!entry.isDirectory()) {\n                    String entryName = entry.getName();\n                    byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);\n                    AppResourceEntity resource = resourceEntityManager.create();","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java#L84-L120","documentation":"Flowable's AppDeploymentBuilder.addBytes() throws this FlowableException when the byte[] argument is null. A resource must carry non-null byte content; the builder validates this before creating the AppResourceEntity.","triggerScenarios":"Calling addBytes(resourceName, null) — e.g. reading file bytes with a method that returned null on failure instead of throwing.","commonSituations":"File-reading helper that silently returns null when the file is missing, or a downloaded artifact stored in a null variable, then handed to addBytes.","solutions":["Check bytes != null before calling addBytes.","Fix the upstream read so it throws on failure rather than returning null.","Use Files.readAllBytes(path) which throws NoSuchFileException on missing files.","Catch FlowableException and report the failing resourceName."],"exampleFix":"// before\nbuilder.addBytes(\"my-app.bar\", readFileQuietly(path)); // may return null\n// after\nbyte[] bytes = java.nio.file.Files.readAllBytes(path); // throws on missing\nbuilder.addBytes(\"my-app.bar\", bytes);","handlingStrategy":"validation","validationCode":"if (bytes == null) { throw new IllegalArgumentException(\"bytes must not be null for resource \" + resourceName); }","typeGuard":"boolean hasBytes(byte[] b) { return b != null && b.length > 0; }","tryCatchPattern":"try {\n    builder.addBytes(resourceName, bytes);\n} catch (org.flowable.common.engine.api.FlowableException e) {\n    logger.error(\"addBytes failed for {}: {}\", resourceName, e.getMessage());\n    throw e;\n}","preventionTips":["Use Files.readAllBytes or InputStream.readAllBytes which throw on failure","Avoid helper methods that return null byte arrays","Check array length > 0 to also catch empty payloads"],"tags":["java","flowable","null-check","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"}