[jboss-jira] [JBoss JIRA] (DROOLS-177) Unary negation of a variable doesn't work right in an expression

Chris Dolan (JIRA) jira-events at lists.jboss.org
Sun Jun 23 01:57:21 EDT 2013


Chris Dolan created DROOLS-177:
----------------------------------

             Summary: Unary negation of a variable doesn't work right in an expression
                 Key: DROOLS-177
                 URL: https://issues.jboss.org/browse/DROOLS-177
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 5.5.0.Final
            Reporter: Chris Dolan
            Assignee: Mark Proctor
            Priority: Minor


Consider this rule:

<code>
rule "Hitpoints.Lethal.Dead"
    when
        Stat(name == StatInput.CON, $con:value)
        CurrentHitpoints(type == "Lethal", value <= -$con)
    then
        insertLogical(new Condition(ConditionInput.TYPE_DEAD));
end
</code>

This emits the following exception:

<code>
Exception in thread "Thread-2" java.lang.RuntimeException: Null accessor on node: $con
	at org.drools.rule.constraint.ConditionAnalyzer.analyzeNode(ConditionAnalyzer.java:247)
	at org.drools.rule.constraint.ConditionAnalyzer.analyzeSingleCondition(ConditionAnalyzer.java:108)
	at org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:99)
	at org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:70)
	at org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:83)
	at org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:270)
	at org.drools.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:51)
	at org.drools.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:250)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
	at java.lang.Thread.run(Thread.java:680)
</code>

If I change the comparison to "value <= (0-$con)" then it works as expected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list