[jboss-jira] [JBoss JIRA] (DROOLS-4902) Can not use mod operators (%) in when clause.
Mario Fusco (Jira)
issues at jboss.org
Tue Jan 7 03:21:13 EST 2020
[ https://issues.redhat.com/browse/DROOLS-4902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco resolved DROOLS-4902.
---------------------------------
Resolution: Done
Fixed in mvel with https://github.com/mvel/mvel/commit/691466dd5657317a421792dfb1c366394288c1fe
In the meanwhile you can workaround this issue with additional parenthesis like in:
{code}
Number( (this % 5) == 0 )
{code}
> Can not use mod operators (%) in when clause.
> ---------------------------------------------
>
> Key: DROOLS-4902
> URL: https://issues.redhat.com/browse/DROOLS-4902
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.31.0.Final
> Reporter: xb l
> Assignee: Mario Fusco
> Priority: Major
>
> When I study drools , I write a rule use divide operator
> {code:java}
> rule "Buzz" salience 2
> when
> $n: Number( this / 5 == 3 )
> then
> System.out.println("Buzz");
> end
> {code}
> It's OK.
> But:
> {code:java}
> rule "Buzz" salience 2
> when
> $n: Number( this % 5 == 0 )
> then
> System.out.println("Buzz");
> end
> {code}
> Report parser error: Unable to Analyse Expression this % 5 == 0:
> The drools document mentioned the same example:
> Person( age > 100 && ( age % 10 == 0 ) )
> % is Multiplicative operators, why parser error?
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list