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

Guillaume Nodet commented on CAMEL-27866:
-----------------------------------------

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

Triage confirmed 4 bugs in camel-validator:
1. failOnNullHeader ignored / non-XML silently passes: 
ValidatingProcessor.getSource() checks isFailOnNullBody() even when validating 
a header; unconvertible content gets replaced by an empty DOM that passes any 
schema.
2. Custom schemaFactory gets no resolver: ValidatorEndpoint.createProducer() 
sets resourceResolver on SchemaReader then overwrites schemaFactory with the 
custom factory, bypassing createSchemaFactory() where the resolver is applied.
3. Absolute schemaLocations get folder prepended: 
DefaultLSResourceResolver.getUri() prepends resourcePath/ to every non-http(s) 
systemId, breaking file: and classpath: URIs.
4. ValidatorProducer.doShutdown() calls super.doStop() instead of 
super.doShutdown().

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

Reply via email to