{"record":{"id":"1c58c7693e144d68","repo":"flowable/flowable-engine","slug":"org-flowable-cdi-impl-processvariablemap-isempty","errorCode":null,"errorMessage":"org.flowable.cdi.impl.ProcessVariableMap.isEmpty() is not supported.","messagePattern":"org\\.flowable\\.cdi\\.impl\\.ProcessVariableMap\\.isEmpty\\(\\) is not supported\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/ProcessVariableMap.java","lineNumber":67,"sourceCode":"        businessProcess.setVariable(key, value);\r\n        return variableBefore;\r\n    }\r\n\r\n    @Override\r\n    public void putAll(Map<? extends String, ? extends Object> m) {\r\n        for (Map.Entry<? extends String, ? extends Object> newEntry : m.entrySet()) {\r\n            businessProcess.setVariable(newEntry.getKey(), newEntry.getValue());\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public int size() {\r\n        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + \".size() is not supported.\");\r\n    }\r\n\r\n    @Override\r\n    public boolean isEmpty() {\r\n        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + \".isEmpty() is not supported.\");\r\n    }\r\n\r\n    @Override\r\n    public boolean containsKey(Object key) {\r\n        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + \".containsKey() is not supported.\");\r\n    }\r\n\r\n    @Override\r\n    public boolean containsValue(Object value) {\r\n        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + \".containsValue() is not supported.\");\r\n    }\r\n\r\n    @Override\r\n    public Object remove(Object key) {\r\n        throw new UnsupportedOperationException(\"ProcessVariableMap.remove is unsupported. Use ProcessVariableMap.put(key, null)\");\r\n    }\r\n\r\n    @Override\r","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/ProcessVariableMap.java#L49-L85","documentation":"ProcessVariableMap.isEmpty() throws UnsupportedOperationException unconditionally. Since size() is unsupported too, emptiness cannot be determined through this map view; the library treats the map as a keyed accessor only.","triggerScenarios":"Calling isEmpty() directly, or indirect callers such as Apache Commons/Google Collections helpers, JSP/EL expressions checking empty vars, or Map-based validation that calls isEmpty() first.","commonSituations":"Template expressions like ${not processVariables.empty}; defensive checks in generic code that operates on any Map; migration of code that previously used a plain HashMap of variables.","solutions":["Check the specific variable instead: map.get(\"name\") != null.","Use BusinessProcess.getVariable(name) for targeted existence checks via the engine.","Remove isEmpty()-based logic around the CDI variable map entirely."],"exampleFix":"// before\nif (processVariableMap.isEmpty()) { ... }\n\n// after\nif (processVariableMap.get(\"myVar\") == null) { ... } // check the variable you actually care about","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { empty = processVariableMap.isEmpty(); } catch (UnsupportedOperationException e) { empty = (processVariableMap.get(\"knownVar\") == null); }","preventionTips":["Check specific variables with get(name) instead of isEmpty()","Do not wrap the CDI map in generic Map utilities","Prefer engine VariableScope APIs for introspection"],"tags":["java","cdi","unsupported-operation","map"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}