I am no expert on <otherwise>, but I think that it has no context of
what was found.
In other words, you are trying to apply <hint>, but Windup doesn't know
what to apply it to. The file is only "known" in the scope of nested
<when> and in <perform> .
Again, that's my guess, someone more knowledgable may confirm or not.
If I am right, then you could either do a nested <perform><iteration>:
The first would find {*}Tag.java, the nested <when> would find the
pattern, or not:
<rule id="TagLib release">
<when>
<filename pathPattern="{*}Tag.java" as="file"/>
</when>
<perform><iteration>
<when>
<filecontent pattern="release" fileref="file"
/>
</when>
<otherwise>
<hint message="C7.1 : No release in Tag"
effort="4" />
</otherwise>
</iteration></perform>
</rule>
This won't work, we don't have <filename> and <filecontent>
doesn't have fileref.
A chance for you to submit a Jira :)
HTH,
Ondra
On 22.5.2015 12:14, Gilles Bardouillet wrote:
Hi,
I wrote an XML rule with an action specified in "otherwise" part, but
the action is not launched when the condition is false :-(
Here is my rule :
<rule id="TagLib release">
<when>
<filecontent pattern="release"
filename="{*}Tag.java" />
</when>
<otherwise>
<hint message="C7.1 : No release in Tag"
effort="4" />
</otherwise>
</rule>
In overview panel, this xml rule is converted in
addRule()
.when(And.all(FileContent.matches(release).inFilesNamed({*}Tag.java).as(default))
)
.perform(new NoOp()
)
withId("TagLib release")
It seems that "otherwise" action disappeared !
Any tip ?
Gilles.
_______________________________________________
Windup-users mailing list
Windup-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/windup-users