gnodet opened a new pull request, #31244:
URL: https://github.com/apache/camel/pull/31244

   Fixes four bugs in the XML validator component discovered during code audit 
of CAMEL-27866.
   
   ## Bug 1 — `failOnNullHeader` ignored in `ValidatingProcessor.getSource()` 
(CAMEL-27866)
   
   `getSource()` unconditionally checked `isFailOnNullBody()` even when 
validating a header (`headerName` was set). When the header value could not be 
converted to a `Source`, the validator either silently skipped validation or 
threw an `ExpectedBodyTypeException` regardless of the `failOnNullHeader` 
setting.
   
   **Fix:** `ValidatingProcessor.getSource()` now checks `shouldUseHeader() ? 
isFailOnNullHeader() : isFailOnNullBody()`.
   
   ## Bug 2 — `SchemaReader.setSchemaFactory()` did not forward the resource 
resolver
   
   `SchemaReader.setSchemaFactory()` stored the user-supplied factory but never 
called `setResourceResolver()` on it. As a result, a custom `SchemaFactory` 
compiled schemas without the LSResourceResolver configured on the endpoint, 
breaking `xs:import` / `xs:include` resolution.
   
   **Fix:** `setSchemaFactory()` now forwards `getResourceResolver()` to the 
custom factory when a resolver has been set.
   
   ## Bug 3 — `DefaultLSResourceResolver.getUri()` corrupted `file:`-scheme 
system-ids
   
   `getUri()` guarded only `http:` and `https:` schemes, so a `file:`-prefixed 
system-id from a schema's `xs:import` got the schema directory path prepended, 
producing a double-prefixed URI that could not be resolved.
   
   **Fix:** `file:` is added to the existing scheme guard alongside 
`http:`/`https:`.
   
   ## Bug 4 — `ValidatorProducer.doShutdown()` called `super.doStop()`
   
   `doShutdown()` delegated to `super.doStop()` instead of 
`super.doShutdown()`, leaving the service lifecycle incomplete on shutdown.
   
   **Fix:** Corrected to `super.doShutdown()`.
   
   ## Tests
   
   - `SchemaReaderCustomFactoryTest` (camel-xml-jaxp): unit tests for Bug 2 — 
verifies the resolver is forwarded to a custom factory.
   - `ValidatorFailOnNullHeaderTest` (camel-core): integration tests for Bug 1 
— null header pass-through, null header failure, valid XML header, invalid XML 
header all behave correctly.
   
   > _Hermès on behalf of gnodet_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to