[jboss-jira] [JBoss JIRA] Created: (JBRULES-1170) ClassCastException using dynamic salience

Yuri de Wit (JIRA) jira-events at lists.jboss.org
Tue Sep 4 18:00:11 EDT 2007


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


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

        



More information about the jboss-jira mailing list