[
http://jira.jboss.com/jira/browse/JBRULES-1170?page=all ]
Mark Proctor closed JBRULES-1170.
---------------------------------
Fix Version/s: 4.0.2
Resolution: Done
fixed.
ClassCastException using dynamic salience
-----------------------------------------
Key: JBRULES-1170
URL:
http://jira.jboss.com/jira/browse/JBRULES-1170
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 4.0.1
Reporter: Yuri de Wit
Assigned To: Mark Proctor
Fix For: 4.0.2
I have the following dynamic salience:
salience ( -10000 / (c.size * t.size) )
that throws a ClassCastException when c.size * t.size is an odd number:
java.lang.ClassCastException: java.lang.Double
at org.drools.base.mvel.MVELSalienceExpression.getValue(MVELSalienceExpression.java:33)
I then tried:
salience ( (int)-10000 / (c.size * t.size) )
or
salience ( (int)( -10000 / (c.size * t.size) ))
But got a MVEL error compiling the expression.
The solution I found was to use a function:
salience ( -1 * FN.priority(c.size, t.size) )
Note that I had to use "-1 *" because just "-" gives me a MVEL error
compiling the expression.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira