flowable/flowable-engine · error · UnsupportedOperationException

org.flowable.cdi.impl.ProcessVariableMap.isEmpty() is not…

Error message

org.flowable.cdi.impl.ProcessVariableMap.isEmpty() is not supported.

What it means

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.

Solutions

  1. Check the specific variable instead: map.get("name") != null.
  2. Use BusinessProcess.getVariable(name) for targeted existence checks via the engine.
  3. Remove isEmpty()-based logic around the CDI variable map entirely.

Example fix

// before
if (processVariableMap.isEmpty()) { ... }

// after
if (processVariableMap.get("myVar") == null) { ... } // check the variable you actually care about
Defensive patterns

Strategy: try-catch

Try / catch

try { empty = processVariableMap.isEmpty(); } catch (UnsupportedOperationException e) { empty = (processVariableMap.get("knownVar") == null); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/1c58c7693e144d68. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/ProcessVariableMap.java:67

        businessProcess.setVariable(key, value);
        return variableBefore;
    }

    @Override
    public void putAll(Map<? extends String, ? extends Object> m) {
        for (Map.Entry<? extends String, ? extends Object> newEntry : m.entrySet()) {
            businessProcess.setVariable(newEntry.getKey(), newEntry.getValue());
        }
    }

    @Override
    public int size() {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".size() is not supported.");
    }

    @Override
    public boolean isEmpty() {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".isEmpty() is not supported.");
    }

    @Override
    public boolean containsKey(Object key) {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".containsKey() is not supported.");
    }

    @Override
    public boolean containsValue(Object value) {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".containsValue() is not supported.");
    }

    @Override
    public Object remove(Object key) {
        throw new UnsupportedOperationException("ProcessVariableMap.remove is unsupported. Use ProcessVariableMap.put(key, null)");
    }

    @Override

View on GitHub (pinned to d6d39ce1c6)