davsclaus opened a new pull request, #30689:
URL: https://github.com/apache/camel/pull/30689

   _Claude Code on behalf of davsclaus_
   
   [CAMEL-27483](https://issues.apache.org/jira/browse/CAMEL-27483)
   
   ### Problem
   
   `XmlConverter` sets a `DocumentBuilderLoggingErrorHandler` on its 
`DocumentBuilder`. The handler logged `fatalError` and `error` at ERROR, with 
the stack trace, and then the parser threw the same `SAXParseException`. So a 
route that handles the exception (`doTry`, `onException`) still got an ERROR 
line and a stack trace for every body that is not well-formed XML, e.g. 
"Content is not allowed in prolog". Found with the xpath-filter-action Kamelet 
(apache/camel-kamelets#3378).
   
   ### Change
   
   - `fatalError` throws the exception, which is what the JDK's default handler 
does too (it also prints to stderr, which is why the handler is set at all).
   - `warning` and `error` (recoverable) log at DEBUG.
   - Upgrade-guide entry, since people who alert on ERROR lines will see fewer 
of them.
   
   ### Tests
   
   - `XmlConverterParseErrorLogTest`: plain text ("Content is not allowed in 
prolog.") and XML that is not well formed still throw `SAXParseException`, and 
nothing is logged at WARN or above by `org.apache.camel.converter.jaxp`. On the 
original code, both tests fail with the ERROR line.
   - `XmlConverterTest`, `XmlConvertersEdgeCasesTest` and `DomConverterTest` 
pass.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to