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

   ## Summary
   
   _Claude Code on behalf of davsclaus_
   
   Fixes four interrelated bugs in `XsltSaxonEndpoint` originating from 
CAMEL-14501 (2020):
   
   - **Dead null-guard**: `saxonReaderProperties` is initialized to an empty 
`HashMap`, so `if (saxonReaderProperties != null)` is always true — every 
stylesheet is unconditionally re-wrapped through `createReaderForSource()`. 
Fixed by guarding with `!saxonReaderProperties.isEmpty()`.
   
   - **DOMSource broken**: A custom `URIResolver` returning a `DOMSource` gets 
`SAXSource.sourceToInputSource()` → `null`, producing a `SAXSource` with null 
`InputSource`. Fixed by checking if `sourceToInputSource()` returns null and 
passing the original source through unchanged.
   
   - **Unhardened SAXParserFactory**: `createReaderForSource()` creates a bare 
`SAXParserFactory.newInstance()` with zero security features. Fixed by enabling 
`FEATURE_SECURE_PROCESSING`, `disallow-doctype-decl`, and disabling external 
entities — matching the hardening used elsewhere in Camel.
   
   - **Unreachable null-source error**: In `loadResource()`, the wrap happened 
before the `source == null` check, so the intended `IOException("Cannot load 
schema resource ...")` could never fire. Fixed by checking null first, matching 
the parent `XsltEndpoint.loadResource()`.
   
   Additionally: `Boolean.valueOf()` → `Boolean.parseBoolean()` (avoids 
unnecessary boxing), and error fallback returns the original source instead of 
null.
   
   ## Test plan
   
   - [x] New `XsltSaxonUriResolverDomSourceTest` — custom `URIResolver` 
returning `DOMSource` with xslt-saxon route (was broken, now passes)
   - [x] All 38 existing camel-xslt-saxon tests pass
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   Co-Authored-By: Claude Opus 4.6 <[email protected]>


-- 
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