flowable/flowable-engine · error · UnsupportedOperationException

org.flowable.cdi.impl.ProcessVariableMap.containsKey() is no

Error message

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

What it means

ProcessVariableMap.containsKey(Object) throws UnsupportedOperationException unconditionally. Existence of a process variable cannot be checked without engine queries that this read/write keyed view does not perform.

Source

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

    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
    public void clear() {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".clear() is not supported.");
    }

    @Override

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Use get(name) != null as a proxy for existence when null values are not meaningful in your process.
  2. Query the engine API (e.g. via BusinessProcess or VariableScope) to check variable existence including null-valued variables.
  3. Never hand this map to utilities that call containsKey.

Example fix

// before
if (processVariableMap.containsKey("myVar")) { ... }

// after
if (processVariableMap.get("myVar") != null) { ... }
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = processVariableMap.get("myVar") != null; // proxy for containsKey when null values are not used

Try / catch

try { has = processVariableMap.containsKey(name); } catch (UnsupportedOperationException e) { has = processVariableMap.get(name) != null; }

Prevention

When it happens

Trigger: Calling containsKey(name) directly, or delegating utilities (e.g. MapUtils, bean wrappers) that check key presence before get(); serialization frameworks probing the map for known keys.

Common situations: Code that distinguishes 'variable is null' from 'variable not set' using containsKey; generic caching layers wrapping the map.

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/2341a82b87a5271d. Report an issue: GitHub.