Aurélien Pupier created CAMEL-22884:
---------------------------------------
Summary: Provide error at build time or runtime when a `method`
attribute is used inside a when clause in xml dsl
Key: CAMEL-22884
URL: https://issues.apache.org/jira/browse/CAMEL-22884
Project: Camel
Issue Type: Improvement
Affects Versions: 4.17.0
Reporter: Aurélien Pupier
Currently, when a method attribute is provided at the wrong place, it is still
called and can be a duplicate of when expression clause.
It must be at the first position. And there shouldn't be several clause
expression for the when.
For instance:
{noformat}
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<route xmlns="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<from uri="direct://start"/>
<choice>
<when>
<xpath saxon="true">/*:test/*:foo/text() = 'bar'</xpath>
<log message="Condition met: foo equals bar"/>
<method ref="someBean" method="processFooBar"/>
</when>
<otherwise>
<log message="Condition not met: foo does not equal bar"/>
</otherwise>
</choice>
</route>
</routes>
{noformat}
the route will star without any issue and the second method will be called.
The xsd validation is rejecting it but if no xsd validation used, the route is
accepted at build time and runtime.
it would nice to fail the build when it happens.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)