[
https://issues.apache.org/jira/browse/CAMEL-27866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18153402#comment-18153402
]
Guillaume Nodet commented on CAMEL-27866:
-----------------------------------------
This issue is being investigated by a coding agent (on behalf of gnodet).
All 4 bugs have been confirmed in the main branch source code:
1. *failOnNullHeader ignored* - ValidatingProcessor.getSource() uses
isFailOnNullBody() even when validating a header. With failOnNullBody=false,
unconvertible content gets an empty DOM document that passes validation.
2. *Custom schemaFactory gets no resolver* - ValidatorEndpoint.createProducer()
sets resolver on schemaReader, but when a custom schemaFactory is provided,
SchemaReader.getSchemaFactory() returns it directly without applying the
resolver or schemaLanguage.
3. *Absolute schemaLocations get folder prepended* -
DefaultLSResourceResolver.getUri() only exempts http/https from path
prepending. URIs with file:, classpath:, etc. get the resource folder
incorrectly prepended.
4. *doShutdown calls super.doStop()* - ValidatorProducer.doShutdown() calls
super.doStop() instead of super.doShutdown().
A fix is being prepared.
_Note: This comment was generated by an AI coding agent and requires manual
verification._
> camel-validator: failOnNullHeader is ignored, non-XML content passes with
> failOnNullBody=false, a custom schemaFactory gets no resolver
> ---------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27866
> URL: https://issues.apache.org/jira/browse/CAMEL-27866
> Project: Camel
> Issue Type: Bug
> Components: camel-validator
> Reporter: Claus Ibsen
> Assignee: Guillaume Nodet
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-validator for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/1aaff12f7925110d68d6576bdc6977b75773cc4a,
> pull request https://github.com/apache/camel/pull/31146).
> These are separate problems of the component; the descriptions change only
> documents the current behavior.
> h4. 1. failOnNullHeader is ignored and non-XML content can pass
> {{ValidatingProcessor.getSource}} (camel-xml-jaxp) uses isFailOnNullBody()
> also when headerName is set. With failOnNullBody=false, content that cannot
> be converted to a Source is replaced by an empty DOM document, which
> validates without errors, so a non-XML body passes as valid.
> Proposed change: use isFailOnNullHeader() for a header, and skip validation
> as for a null body instead of validating a placeholder.
> h4. 2. A custom schemaFactory gets no resource resolver
> SchemaReader / ValidatorEndpoint.createProducer use a custom schemaFactory as
> it is: resourceResolver, resourceResolverFactory and the default resolver are
> never set, so relative xs:import/xs:include of a classpath schema fail;
> schemaLanguage is ignored too.
> Proposed change: set the resolver on a custom factory that has none.
> h4. 3. Absolute schemaLocations get the folder prepended
> {{DefaultLSResourceResolver.getUri}} puts the folder of resourceUri in front
> of every schemaLocation that is not http(s), so file:/... or classpath:...
> becomes "folder/file:/..." and fails.
> Proposed change: resolve only scheme-less locations relative to the folder.
> h4. 4. doShutdown calls doStop
> {{ValidatorProducer.doShutdown}} calls super.doStop() instead of
> super.doShutdown() (harmless today).
> Proposed change: call super.doShutdown().
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)