Claus Ibsen created CAMEL-27679:
-----------------------------------
Summary: camel-xj: resultHandlerFactory, allowStAX, useJsonBody
(JSON2XML) ignored; texts unfit
Key: CAMEL-27679
URL: https://issues.apache.org/jira/browse/CAMEL-27679
Project: Camel
Issue Type: Bug
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-xj for CAMEL-23832 (PR
(commit
https://github.com/apache/camel/commit/d7001c8dee4e4d8f100f227de2a7147b9aedf396)).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. resultHandlerFactory has no effect
{{XsltSaxonEndpoint.createXsltBuilder()}} (camel-xslt-saxon, inherited by xj)
sets the {{resultHandlerFactory}} option on the builder and then calls
{{configureOutput(xslt, getOutput().name())}}. As {{output}} defaults to
{{string}}, {{configureOutput()}} always runs and replaces it
({{XsltBuilder.outputString()}} etc., and in xj
{{XJEndpoint.configureJsonOutput()}} for XML2JSON). A custom result handler
factory set on the endpoint is never used.
Apply the option after {{configureOutput()}}, as
{{XsltEndpoint.createXsltBuilder()}} in camel-xslt does (in xj also for
XML2JSON).
h4. 2. allowStAX has no effect in xj
{{XJEndpoint.createXsltBuilder()}} calls the parent, which applies
{{allowStAX}}, and then always calls {{xsltBuilder.setAllowStAX(true)}}.
{{allowStAX=false}} is silently ignored.
Either document that xj always uses StAX, or reject/warn on {{allowStAX=false}}.
h4. 3. useJsonBody has no effect with JSON2XML
With {{transformDirection=JSON2XML}}, {{XJEndpoint.configureInput()}} sets its
own {{JsonSourceHandlerFactoryImpl}}, so the
{{SaxonXmlSourceHandlerFactoryImpl}} that reads {{useJsonBody}} is not used.
The option only changes something with XML2JSON.
Document this, or warn when both are set.
h4. 4. Inherited option texts do not fit xj
* {{resourceUri}} does not mention the special value {{identity}}, which
{{XJEndpoint.doInit()}} maps to the built-in {{identity.xsl}}.
* {{output}} lists {{DOM}} as a possible value, but
{{XJEndpoint.configureJsonOutput()}} throws {{UnsupportedOperationException}}
for it with XML2JSON.
These texts are defined in camel-xslt; xj would need its own texts (or the
parent texts a note about xj).
h4. 5. Text problems in the shared camel-xslt / camel-xslt-saxon texts
* {{CamelXsltFileName}} in {{XsltConstants}} reads "The XSLT file name"; it is
the path of the output file with {{output=file}}.
* {{transformerCacheSize}} says {{Template.newTransformer()}}; the JAXP type is
{{Templates}}.
* {{saxonExtensionFunctions}} (endpoint) reads "where you can comma to
separate" (missing "use").
* {{CamelXsltStylesheet}} has a trailing space in its {{@Metadata}} description.
* The xj doc page ({{xj-component.adoc}}) says "identify transforma" for the
identity transform.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)