[jboss-jira] [JBoss JIRA] Closed: (JBRULES-1558) || in conditional element causes exception

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Wed Apr 30 13:57:28 EDT 2008


     [ http://jira.jboss.com/jira/browse/JBRULES-1558?page=all ]

Edson Tirelli closed JBRULES-1558.
----------------------------------

    Fix Version/s: 5.0.0-M1
                   4.0.6
       Resolution: Duplicate Issue

http://jira.jboss.org/jira/browse/JBRULES-1519

Fixed already.

> || in conditional element causes exception
> ------------------------------------------
>
>                 Key: JBRULES-1558
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-1558
>             Project: JBoss Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Reteoo
>    Affects Versions: 4.0.4
>            Reporter: Juraj Bednar
>         Assigned To: Edson Tirelli
>            Priority: Minor
>             Fix For: 5.0.0-M1, 4.0.6
>
>
> rule "testRule"
>   dialect "mvel"
>   when
>    $m : TestFact ( booleanTest == true && (number <= 100 || number >= (anotherNumber * 2)))
>   then
>    System.out.println("Error");
> end
> ("&&" can be also replaced by "," having the same effect)
> This rule compiles well and in runtime, when booleanTest becomes true, it creates this Runtime exception:
> org.drools.RuntimeDroolsException: Exception executing ReturnValue constraint org.drools.rule.ReturnValueRestriction at 3f3d9830 : java.lang.ClassCastException: org.drools.rule.AbstractCompositeConstraint$MultiFieldConstraintContextEntry cannot be cast to org.drools.rule.ReturnValueRestriction$ReturnValueContextEntry
> 	at org.drools.rule.ReturnValueConstraint.isAllowed(ReturnValueConstraint.java:102)
> 	at org.drools.rule.OrConstraint.isAllowed(OrConstraint.java:50)
> 	at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
> 	at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
> 	at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
> 	at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:309)
> 	at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
> 	at org.drools.reteoo.Rete.assertObject(Rete.java:175)
> 	at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
> 	at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
> 	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:915)
> 	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:887)
> 	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:688)
> 	at spairal.sensors.AbstractSensor.collectData(AbstractSensor.java:60)
> 	at spairal.SensorManager$1.run(SensorManager.java:55)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:287)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:679)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:704)
> 	at java.lang.Thread.run(Thread.java:637)
> Caused by: org.drools.RuntimeDroolsException: java.lang.ClassCastException: org.drools.rule.AbstractCompositeConstraint$MultiFieldConstraintContextEntry cannot be cast to org.drools.rule.ReturnValueRestriction$ReturnValueContextEntry
> 	at org.drools.rule.ReturnValueRestriction.isAllowed(ReturnValueRestriction.java:175)
> 	at org.drools.rule.ReturnValueConstraint.isAllowed(ReturnValueConstraint.java:96)
> 	... 20 more
> Caused by: java.lang.ClassCastException: org.drools.rule.AbstractCompositeConstraint$MultiFieldConstraintContextEntry cannot be cast to org.drools.rule.ReturnValueRestriction$ReturnValueContextEntry
> 	at org.drools.rule.ReturnValueRestriction.isAllowed(ReturnValueRestriction.java:165)
> 	... 21 more
> The syntax is OK according to documentation:
> -----
> It is possible to change the evaluation priority by using parenthesis, as in any logic or mathematical expression. Example:
> Example 6.10. Using parenthesis to change evaluation priority
> # Cheese type is stilton and ( price is less than 20 or age is mature ).
> Cheese( type == "stilton" && ( price < 20 || age == "mature" ) ) 
> -----

-- 
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