flowable/flowable-engine · error · DmnXMLException

The dmn xml is not properly encoded

Error message

The dmn xml is not properly encoded

What it means

In convertToDmnModel(InputStreamProvider, validateSchema, enableSafeDmnXml, encoding), the first validation pass opens the input stream with the given encoding. If java throws UnsupportedEncodingException (the encoding name is not a supported charset), it becomes DmnXMLException "The dmn xml is not properly encoded".

Solutions

  1. Use a canonical charset name like "UTF-8" or a StandardCharsets.name() constant
  2. Validate the configured encoding via Charset.isSupported(name) before calling
  3. Check the JVM supports the requested charset (Charset.availableCharsets())
  4. Fall back to the 3-arg convertToDmnModel which uses DEFAULT_ENCODING

Example fix

// before
converter.convertToDmnModel(provider, true, true, "utf8");
// after
converter.convertToDmnModel(provider, true, true, StandardCharsets.UTF_8.name());
Defensive patterns

Strategy: validation

Validate before calling

if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException("Unsupported charset: " + encoding); }

Try / catch

try { converter.convertToDmnModel(provider, true, true, encoding); } catch (DmnXMLException e) { if (e.getCause() instanceof UnsupportedEncodingException) { log.error("Bad charset: {}", encoding); } }

Prevention

When it happens

Trigger: Passing an invalid charset name to the 4-arg convertToDmnModel — e.g. convertToDmnModel(provider, true, true, "utf8-longname") — or a JDK lacking that charset; both the validation and conversion readers use this encoding.

Common situations: Typo in encoding string read from configuration ("UTF-8" vs "utf_8"); locale-dependent config producing wrong charset names; running on a JVM with a minimal charsets package (older/embedded JREs).

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-dmn-xml-converter/src/main/java/org/flowable/dmn/xml/converter/DmnXMLConverter.java:249

        }
        
        if (xif.isPropertySupported(XMLConstants.ACCESS_EXTERNAL_DTD)) {
            xif.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
        }
        
        if (xif.isPropertySupported(XMLConstants.ACCESS_EXTERNAL_SCHEMA)) {
            xif.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
        }

        if (validateSchema) {
            try (InputStreamReader in = new InputStreamReader(inputStreamProvider.getInputStream(), encoding)) {
                if (!enableSafeDmnXml) {
                    validateModel(inputStreamProvider);
                } else {
                    validateModel(xif.createXMLStreamReader(in));
                }
            } catch (UnsupportedEncodingException e) {
                throw new DmnXMLException("The dmn xml is not properly encoded", e);
            } catch (XMLStreamException e) {
                throw new DmnXMLException("Error while reading the dmn xml file", e);
            } catch (Exception e) {
                throw new DmnXMLException(e.getMessage(), e);
            }
        }
        // The input stream is closed after schema validation
        try (InputStreamReader in = new InputStreamReader(inputStreamProvider.getInputStream(), encoding)) {
            // XML conversion
            return convertToDmnModel(xif.createXMLStreamReader(in));
        } catch (UnsupportedEncodingException e) {
            throw new DmnXMLException("The dmn xml is not properly encoded", e);
        } catch (XMLStreamException e) {
            throw new DmnXMLException("Error while reading the dmn xml file", e);
        } catch (IOException e) {
            throw new DmnXMLException(e.getMessage(), e);
        }
    }

View on GitHub (pinned to d6d39ce1c6)