{"record":{"id":"e996d8d9c96cc9c3","repo":"flowable/flowable-engine","slug":"error-while-moving-to-end-of-element","errorCode":null,"errorMessage":"Error while moving to end of element {}","messagePattern":"Error while moving to end of element (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/flowable-dmn-xml-converter/src/main/java/org/flowable/dmn/xml/converter/XMLStreamReaderUtil.java","lineNumber":62,"sourceCode":"        return null;\n    }\n\n    public static boolean moveToEndOfElement(XMLStreamReader xtr, String elementName) {\n        try {\n            while (xtr.hasNext()) {\n                int event = xtr.next();\n                switch (event) {\n                case XMLStreamConstants.END_DOCUMENT:\n                    return false;\n                case XMLStreamConstants.END_ELEMENT:\n                    if (xtr.getLocalName().equals(elementName)) {\n                        return true;\n                    }\n                    break;\n                }\n            }\n        } catch (Exception e) {\n            LOGGER.warn(\"Error while moving to end of element {}\", elementName, e);\n        }\n        return false;\n    }\n}\n","sourceCodeStart":44,"sourceCodeEnd":67,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-xml-converter/src/main/java/org/flowable/dmn/xml/converter/XMLStreamReaderUtil.java#L44-L67","documentation":"This is a warning logged (not a thrown exception) by XMLStreamReaderUtil.moveToEndOfElement, which advances the stream reader past the closing tag of the named element. On any exception while skipping forward it logs a warning, returns false, and leaves the cursor wherever it stopped, so the parent converter may continue parsing from a wrong position and drop or duplicate elements.","triggerScenarios":"Calling moveToEndOfElement(xtr, elementName) when the matching closing tag never appears (unterminated element) or the stream throws an XMLStreamException while scanning for the end element inside malformed XML.","commonSituations":"DMN files with mismatched or unclosed tags after hand-editing; a truncated upload; generated XML where an element's closing tag was accidentally deleted; deep nesting that a manual merge broke.","solutions":["Check XML well-formedness with xmllint --noout before feeding the file to the converter; fix unclosed/mismatched tags","Read the logged cause to find the exact offset where scanning stopped","Re-export the model from the Flowable modeler to regenerate clean XML","Compare the file against a known-good version (git diff) to spot the broken tag"],"exampleFix":"<!-- before: unclosed element breaks moveToEndOfElement -->\n<decisionService id=\"ds1\">\n  <outputData output=\"out_1\">\n<!-- after: properly closed -->\n<decisionService id=\"ds1\">\n  <outputData output=\"out_1\" />\n</decisionService>","handlingStrategy":"validation","validationCode":"// Well-formedness check guarantees every start element has a matching end element\nXMLInputFactory f = XMLInputFactory.newFactory();\nf.createXMLStreamReader(new FileInputStream(\"process.bpmn20.xml\")).close(); // throws if tags mismatch","typeGuard":null,"tryCatchPattern":"// moveToToEndOfElement returns false on error; branch on the boolean\nif (!XMLStreamReaderUtil.moveToEndOfElement(xtr, \"decisionService\")) {\n  throw new IllegalStateException(\"Failed to skip to end of decisionService element; XML likely malformed\");\n}","preventionTips":["Ensure every XML tag is closed before deploying generated files","Use an IDE with XML validation or xmllint in CI for all process/DMN resources","Re-export from the modeler after any manual merge of XML files","Investigate warn logs 'moving to end of element' - they mean the parser position is now unreliable"],"tags":["xml-parsing","stax","malformed-xml"],"backgroundTag":"json-parse-error","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}