[ 
https://issues.apache.org/jira/browse/CAMEL-27908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18153323#comment-18153323
 ] 

Guillaume Nodet commented on CAMEL-27908:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Triage findings: Both bugs confirmed in current main branch. (1) NPE in 
XsltBuilder.java line 474-478: tryAddEntityResolver() calls 
source.getXMLReader().setEntityResolver() without null-checking getXMLReader(). 
A SAXSource can legitimately have a null XMLReader per the SAX API. Fix: add 
null-check or create a default XMLReader. (2) xpathTotalOpLimit default 
mismatch: XsltComponent.java line 52 and XsltEndpoint.java line 126 declare the 
field with no initializer (defaults to 0 in Java), but @Metadata/generated JSON 
catalog documents defaultValue=10000. The logic at XsltEndpoint.java line 
481-483 treats 0 as "not set". The annotation should not declare a numeric 
default or should state 0. Both fixes are in camel-xslt, single-PR scope.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._


> camel-xslt: NullPointerException with an entityResolver and a SAXSource body 
> without an XMLReader, xpathTotalOpLimit default differs from the docs
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27908
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27908
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-xslt
>            Reporter: Claus Ibsen
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-xslt for CAMEL-23832 
> (pull request https://github.com/apache/camel/pull/31166).
> These are separate problems of the component; the descriptions change only 
> documents the current behavior.
> h4. 1. NullPointerException with an entityResolver and a SAXSource without an 
> XMLReader
> {{XsltBuilder.tryAddEntityResolver}} calls 
> source.getXMLReader().setEntityResolver(...) without a null check, so a 
> SAXSource body that has no XMLReader fails with a NullPointerException when 
> an entityResolver is set.
> Proposed change: create a reader when it is null, or skip.
> h4. 2. xpathTotalOpLimit default
> The option is documented with default 10000, but the field defaults to 0, in 
> which case Camel sets nothing and the JDK setting applies (10000 in 
> jaxp.properties). On a Saxon factory setAttribute throws 
> IllegalArgumentException, which is caught, so the option does nothing for 
> xslt-saxon.
> Proposed change: align the documented default with the code.
> h4. 3. xsltMessageLogger has no effect on xslt
> xsltMessageLogger is an endpoint option of xslt, but only XsltSaxonBuilder 
> uses it.
> Proposed change: move it to xslt-saxon, or exclude it for xslt.
> _Claude Code on behalf of davsclaus_



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

Reply via email to