{"record":{"id":"cea8a469e4849a80","repo":"flowable/flowable-engine","slug":"error-reading-xml-cea8a4","errorCode":null,"errorMessage":"Error reading XML","messagePattern":"Error reading XML","errorType":"exception","errorClass":"CmmnXMLException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/CmmnXmlConverter.java","lineNumber":219,"sourceCode":"            throw new CmmnXMLException(\"Error while reading the CMMN 1.1 XML\", e);\n        } catch (IOException e) {\n            throw new CmmnXMLException(e.getMessage(), e);\n        }\n    }\n\n    public CmmnModel convertToCmmnModel(XMLStreamReader xtr) {\n\n        ConversionHelper conversionHelper = new ConversionHelper();\n        conversionHelper.setCmmnModel(new CmmnModel());\n\n        try {\n            String currentXmlElement = null;\n            while (xtr.hasNext()) {\n                try {\n                    xtr.next();\n                } catch (Exception e) {\n                    LOGGER.debug(\"Error reading CMMN XML document\", e);\n                    throw new CmmnXMLException(\"Error reading XML\", e);\n                }\n\n                if (xtr.isStartElement()) {\n                    currentXmlElement = xtr.getLocalName();\n                    if (elementConverters.containsKey(currentXmlElement)) {\n                        elementConverters.get(currentXmlElement).convertToCmmnModel(xtr, conversionHelper);\n                    }\n\n                } else if (xtr.isEndElement()) {\n                    currentXmlElement = null;\n                    if (elementConverters.containsKey(xtr.getLocalName())) {\n                        elementConverters.get(xtr.getLocalName()).elementEnd(xtr, conversionHelper);\n                    }\n\n                }\n            }\n\n        } catch (CmmnXMLException e) {","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/CmmnXmlConverter.java#L201-L237","documentation":"During the StAX event loop of convertToCmmnModel, if xtr.next() throws any exception the converter logs it at debug level and rethrows as CmmnXMLException(\"Error reading XML\"). This is a low-level failure while pulling the next XML event from the document.","triggerScenarios":"Calling convertToCmmnModel(XMLStreamReader) with a reader over a malformed or corrupted XML stream where the parser fails mid-document (invalid entities, illegal characters, unexpected EOF inside a tag).","commonSituations":"Same as generic malformed XML: truncated deployments, character encoding drift mid-file, invalid control characters pasted into the CMMN model, or XML containing illegal entity references.","solutions":["Open the CMMN file in an XML editor/validator and fix the syntax at the reported location","Remove illegal control characters or invalid entity references from the XML","Re-generate the file from a modeling tool rather than hand-editing","Enable the converter's LOGGER debug output to see the original parser exception"],"exampleFix":"// before\n<case ... description=\"line1&#x0; line2\"> // illegal control char\n// after\n<case ... description=\"line1 line2\">","handlingStrategy":"validation","validationCode":"try (Reader r = new InputStreamReader(in, StandardCharsets.UTF_8)) {\n    char[] buf = new char[64]; int n = r.read(buf);\n    if (n <= 0 || new String(buf, 0, n).trim().charAt(0) != '<') throw new IllegalStateException(\"Not XML content\");\n}","typeGuard":"boolean looksLikeXml(InputStream in) {\n    try { in.mark(16); byte[] b = new byte[16]; int n = in.read(b); in.reset();\n        return n > 0 && new String(b, 0, n).trim().startsWith(\"<\"); }\n    catch (IOException e) { return false; }\n}","tryCatchPattern":"try {\n    cmmnModel = converter.convertToCmmnModel(xtr);\n} catch (CmmnXMLException e) {\n    log.debug(\"StAX parse failure\", e.getCause()); // original parser exception was logged at debug\n    throw new DeploymentException(\"CMMN XML unreadable at event level\", e);\n}","preventionTips":["Strip illegal control characters from XML content before conversion","Enable debug logging on org.flowable.cmmn.converter to see the underlying parser exception","Avoid hand-editing CMMN XML; use a validating editor"],"tags":["java","cmmn","xml","stax"],"backgroundTag":"invalid-argument-format","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}