Claus Ibsen created CAMEL-27803:
-----------------------------------

             Summary: camel-schematron: the status is FAILED when the report 
text contains failed-assert, sch:include gives an NPE, the rules are never 
reloaded
                 Key: CAMEL-27803
                 URL: https://issues.apache.org/jira/browse/CAMEL-27803
             Project: Camel
          Issue Type: Bug
          Components: camel-schematron
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-schematron for 
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31138).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. The status is FAILED when the report contains the text failed-assert 
anywhere
{{SchematronProducer.getValidationStatus}} uses 
{{report.contains(Constants.FAILED_ASSERT)}}. A report rule whose text is "no 
failed-assert here", with no failed assert, comes back FAILED (tested), and 
with abort=true it throws.
Proposed change: count {{svrl:failed-assert}} elements (XPath on the report).

h4. 2. sch:include without a uriResolver gives a NullPointerException
{{TemplatesFactory.getTemplates}} reads the rules with {{new 
StreamSource(rules)}} without a systemId, and {{ClassPathURIResolver.resolve}} 
returns {{new StreamSource(null)}} instead of null when it finds nothing. An 
include of a file next to the rules fails at endpoint start with "spec is null" 
inside fn:document.
Proposed change: set the URL of the rules resource as systemId and return null 
from the resolver (compatible with ACCESS_EXTERNAL_STYLESHEET="").

h4. 3. The rules are never reloaded
{{SchematronEndpoint.doStart}} loads the rules only when they are null and 
there is no doStop, so a changed rules file is not picked up; the doc tip says 
restarting the route or component is enough.
Proposed change: clear rules loaded from the path in doStop, or fix the tip.

h4. 4. Smaller issues
With abort=true the status and report headers are not set. The two headers are 
not in the catalog (no headersClass).


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to