Claus Ibsen created CAMEL-27866:
-----------------------------------
Summary: 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
Fix For: 4.25.0
Found while improving the option descriptions of camel-validator for
CAMEL-23832 (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)