{"record":{"id":"2db87e200e754492","repo":"flowable/flowable-engine","slug":"value-cannot-be-null","errorCode":null,"errorMessage":"value cannot be null","messagePattern":"value cannot be null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el/util/CollectionUtil.java","lineNumber":39,"sourceCode":"/**\n * @author Yvo Swillens\n */\npublic class CollectionUtil {\n\n    /**\n     * all values of value must be in collection\n     *\n     * @return {@code true} if all elements of value are within the collection,\n     * {@code false} if at least one element of value is not within the collection\n     */\n    public static boolean allOf(Object collection, Object value) {\n\n        if (collection == null) {\n            throw new IllegalArgumentException(\"collection cannot be null\");\n        }\n\n        if (value == null) {\n            throw new IllegalArgumentException(\"value cannot be null\");\n        }\n\n        // collection to check against\n        Collection targetCollection = getTargetCollection(collection, value);\n\n        // elements to check\n        if (DMNParseUtil.isParseableCollection(value)) {\n            Collection valueCollection = DMNParseUtil.parseCollection(value, targetCollection);\n            return valueCollection != null && targetCollection.containsAll(valueCollection);\n        } else if (DMNParseUtil.isJavaCollection(value)) {\n            return targetCollection.containsAll((Collection) value);\n        } else if (DMNParseUtil.isArrayNode(value)) {\n            Collection valueCollection = DMNParseUtil.getCollectionFromArrayNode(JsonUtil.asFlowableArrayNode(value));\n            return valueCollection != null && targetCollection.containsAll(valueCollection);\n        } else {\n            Object formattedValue = DMNParseUtil.getFormattedValue(value, targetCollection);\n            return targetCollection.contains(formattedValue);\n        }","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el/util/CollectionUtil.java#L21-L57","documentation":"CollectionUtil.allOf also requires the value operand (the elements expected to be contained) to be non-null. Passing a null value makes the 'all elements within collection' predicate undefined, so Flowable throws IllegalArgumentException. Note ordering: the null collection check runs first, so if both are null you get 'collection cannot be null' instead.","triggerScenarios":"A DMN input entry evaluates contains(collection, allOf(value)) where value — the list/set of elements that must all be present — is null, usually because the variable holding it was never set or a mapping produced null.","commonSituations":"Required-subset variable missing in the process variables map; a transformation step returning null instead of an empty list; DMN hit policy input where the 'value' column expression references an undefined variable.","solutions":["Ensure the value variable is initialized to an empty collection before DMN evaluation rather than left null.","Add a null check in the expression: ${value != null && contains(collection, allOf(value))}.","Make the producer of the value collection return Collections.emptyList() for the absent case.","Validate input payloads so required list fields are present before invoking the rule task.","Catch IllegalArgumentException in the caller and treat it as a validation failure of the DMN input data."],"exampleFix":"// before\nexecution.setVariable(\"requiredSubset\", null);\n// after\nexecution.setVariable(\"requiredSubset\", requiredSubset == null ? Collections.emptyList() : requiredSubset);","handlingStrategy":"validation","validationCode":"if (required == null) throw new IllegalStateException(\"required subset must be non-null before allOf\");","typeGuard":"boolean isNonNullCollection(Object c) { return c != null && c instanceof Collection<?>; }","tryCatchPattern":"try {\n    CollectionUtil.allOf(collection, value);\n} catch (IllegalArgumentException e) {\n    if (\"value cannot be null\".equals(e.getMessage())) { /* value operand missing */ }\n}","preventionTips":["Initialize the value/elements variable to an empty collection if absent.","Note check order: collection null check fires before value check.","Default producers to Collections.emptyList().","Validate DMN inputs before rule execution.","Catch IllegalArgumentException as input-validation failure."],"tags":["dmn","collection-util","null-check"],"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"}