{"record":{"id":"877d0c14785cafda","repo":"flowable/flowable-engine","slug":"error-converting-condition","errorCode":null,"errorMessage":"Error converting condition","messagePattern":"Error converting condition","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/ConditionXmlConverter.java","lineNumber":52,"sourceCode":"    @Override\n    public boolean hasChildElements() {\n        return false;\n    }\n\n    @Override\n    protected CmmnElement convert(XMLStreamReader xtr, ConversionHelper conversionHelper) {\n        try {\n            String condition = xtr.getElementText();\n            if (StringUtils.isNotEmpty(condition)) {\n                CmmnElement currentCmmnElement = conversionHelper.getCurrentCmmnElement();\n                if (currentCmmnElement instanceof SentryIfPart) {\n                    ((SentryIfPart) currentCmmnElement).setCondition(condition);\n                } else if (currentCmmnElement instanceof PlanItemRule) {\n                    ((PlanItemRule) currentCmmnElement).setCondition(condition);\n                }\n            }\n        } catch (XMLStreamException e) {\n            throw new FlowableException(\"Error converting condition\", e);\n        }\n        return null;\n    }\n    \n}","sourceCodeStart":34,"sourceCodeEnd":57,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/ConditionXmlConverter.java#L34-L57","documentation":"Thrown by ConditionXmlConverter.convert when an XMLStreamException occurs while reading a CMMN <condition> element (for ifPart or planItemRule). It wraps low-level XML parsing failure (malformed content, unexpected end of document, invalid characters) into a FlowableException.","triggerScenarios":"xtr.getElementText() or related stream reads throw XMLStreamException: malformed XML inside <condition>, unclosed tags, document truncated mid-element, or invalid encoding/characters.","commonSituations":"Corrupt or hand-truncated CMMN file; XML with wrong encoding declaration; condition bodies containing unescaped characters (e.g. raw & or < in expressions); files edited by non-XML-safe tools.","solutions":["Validate the CMMN XML file with an XML parser/linter and fix malformed markup around the <condition> element.","Escape XML-special characters in the condition expression (&amp;, &lt;, &gt;).","Ensure the file encoding matches the XML declaration and the file is complete (not truncated)."],"exampleFix":"<!-- before -->\n<condition>${var &lt 5 && var > 1}</condition>\n<!-- after -->\n<condition>${var &lt; 5 &amp;&amp; var &gt; 1}</condition>","handlingStrategy":"validation","validationCode":"// Parse the XML with a strict parser before handing it to Flowable\nDocumentBuilderFactory f = DocumentBuilderFactory.newInstance();\nf.setValidating(true);\nDocument doc = f.newDocumentBuilder().parse(cmmnFile); // throws on malformed condition markup","typeGuard":null,"tryCatchPattern":"try {\n    cmmnModel = converter.convertToCmmnModel(stream, encoding);\n} catch (FlowableException e) {\n    if (\"Error converting condition\".equals(e.getMessage()) && e.getCause() instanceof XMLStreamException) {\n        // locate and repair the malformed <condition> element\n    }\n    throw e;\n}","preventionTips":["Validate CMMN files with an XML parser/XSD before conversion.","Escape XML-special characters inside condition expressions.","Avoid hand-truncating or binary-unsafe editing of CMMN files."],"tags":["cmmn","xml","parsing"],"backgroundTag":"schema-validation-failed","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"}