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

   Fixes [CAMEL-25077](https://issues.apache.org/jira/browse/CAMEL-25077): bugs 
in the XML DSL parser and dumper (camel-xml-io, camel-xml-io-util) found in a 
deep review. Each fix has a test that fails without it 
(`MXParserEdgeCasesTest`, `XmlStreamReaderTest`, `DumpModelEdgeCasesTest`).
   
   1. **Two CDATA sections in a row followed by text duplicate the second one, 
or fail the parser.** `<constant><![CDATA[x]]><![CDATA[y]]>z</constant>` gave 
`xyyz`; the idiom to put `]]>` in CDATA followed by a new line 
(`<![CDATA[a]]]]><![CDATA[>b]]>`) gave `a]]>b>b`; with a comment in between it 
failed with `ArrayIndexOutOfBoundsException`. The parser joined the first 
section into its buffer when reading the second, but still marked it as to be 
joined, so the following text joined it again. This comes from the original 
xpp3 code.
   2. **A character reference above U+FFFF is silently truncated**: `&#x1F600;` 
gave U+F600, as the code point was kept in a `char`. A reference that is not a 
valid character now fails.
   3. **`dumpBeansAsXml` produces malformed XML**: the `<script>` of a bean was 
written inside its start tag, and no value was escaped (a url with `&` gave 
invalid XML); a bean without a type failed with NPE. The same copy of that code 
in camel-xml-jaxb is fixed too.
   4. **The XML and YAML dumpers drop the `note` of routes and EIPs** (added in 
CAMEL-22576): their override of the id/description attributes did not write it.
   5. **An encoding declared on another line of the XML declaration is 
ignored**: `<?xml version="1.0"\n encoding="ISO-8859-1"?>` was read as UTF-8.
   
   **Not changed (for a later look)**
   - Whitespace-only expression text is dropped even with `trim="false"`.
   - Each dump and re-parse cycle adds another copy of the xpath namespace.
   - An error for an invalid attribute points at the end of the start tag.
   - With CR-only line endings every line number is 1.
   - A UTF-8 BOM that disagrees with the declared encoding: the declaration 
wins.
   
   The test suites of camel-xml-io, camel-xml-io-util, camel-yaml-io, 
camel-xml-jaxb and camel-core pass (`SagaProducerLongRunningActionHeaderTest` 
only failed with a stale camel-saga jar from before CAMEL-25058, and passes 
with the current one).
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 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