mayurbm commented on PR #25555: URL: https://github.com/apache/camel/pull/25555#issuecomment-5395177960
Hi @Croway, thank you for the review! Updated the PR based on your feedback — went with **option 2** (drop the sniff, catch `SAXParseException`). **Changes made:** - Removed the custom `looksLikeXml()` byte-sniff entirely — as you pointed out, it incorrectly rejected valid encodings like BOM-less UTF-16BE, UTF-32 and EBCDIC - `toDOMDocument(byte[], Exchange)`: wrapped `documentBuilder.parse()` in `try/catch SAXParseException` and rethrow as `TypeConversionException` with a diagnostic message including the original parse error - `toDOMDocument(StreamCache, Exchange)`: changed to delegate through `toDOMDocument(byte[], Exchange)` (was going through `InputStream`) so the same catch applies there too - Removed the 13 `looksLikeXml` unit tests; kept and updated the 3 integration tests verifying `TypeConversionException` is thrown for empty, JSON, and plain-text payloads All 7 module tests pass (`mvn test -pl core/camel-xml-jaxp`), formatting clean. No changes to `XmlStreamReader`. -- 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]
