Claus Ibsen created CAMEL-27483:
-----------------------------------

             Summary: camel-xml-jaxp - XmlConverter logs a parse error at ERROR 
with the stack trace, before the parser throws it anyway
                 Key: CAMEL-27483
                 URL: https://issues.apache.org/jira/browse/CAMEL-27483
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0


{{XmlConverter}} sets a {{DocumentBuilderLoggingErrorHandler}} on its 
DocumentBuilder. It logs {{fatalError}} and {{error}} at ERROR, with the stack 
trace, and the parser then throws the same {{SAXParseException}}. So a route 
that handles the exception (doTry, onException) still gets an ERROR line and a 
stack trace for every message that is not well-formed XML, e.g. "Content is not 
allowed in prolog". Seen with the xpath-filter-action Kamelet.

Fix: no logging at ERROR in the type converter. {{fatalError}} throws the 
exception, as the JDK's own handler does, and {{error}}/{{warning}} log at 
DEBUG/WARN without the duplicate ERROR. The exception carries the message.

Related: CAMEL-24406 (pre-check of non-XML content before parsing).

Found while writing apache/camel-kamelets#3378 (xpath-filter-action) and #3379 
(websocket-source/-sink).

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to