{"record":{"id":"cdabffbdad491795","repo":"flowable/flowable-engine","slug":"text-is-null","errorCode":null,"errorMessage":"text is null","messagePattern":"text 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":89,"sourceCode":"\n    @Override\n    public AppDeploymentBuilder 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            \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 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);","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java#L71-L107","documentation":"Flowable's AppDeploymentBuilder.addString() throws this FlowableException when the caller passes a null text payload for a resource. The builder refuses to create an AppResourceEntity with no content, since deployments require byte content for every resource.","triggerScenarios":"Calling appRepositoryService.createDeployment().addString(resourceName, null) — the text argument is null at the moment of the call.","commonSituations":"Dynamically generated XML/JSON app definition assembled into a variable that was never initialized, or a lookup (config value, template read) that returned null and was passed straight through.","solutions":["Ensure the text variable is non-null before calling addString (initialize or fail fast with a check).","If content may be absent, skip addString entirely instead of passing null.","Use addBytes with a non-null byte[] if you already have raw bytes.","Catch FlowableException around the builder chain and log which resourceName had null text."],"exampleFix":"// before\nbuilder.addString(\"my-app.app.xml\", appXml); // appXml may be null\n// after\nif (appXml != null) {\n    builder.addString(\"my-app.app.xml\", appXml);\n} else {\n    throw new IllegalStateException(\"app definition content missing\");\n}","handlingStrategy":"validation","validationCode":"if (text == null) { throw new IllegalArgumentException(\"text must not be null for resource \" + resourceName); }","typeGuard":"boolean hasText(String s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    builder.addString(resourceName, text);\n} catch (org.flowable.common.engine.api.FlowableException e) {\n    logger.error(\"Failed to add resource {}: {}\", resourceName, e.getMessage());\n    throw e;\n}","preventionTips":["Initialize text variables at declaration","Never let content-producing helpers return null; throw instead","Assert non-null content before building deployments"],"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"}