[jboss-jira] [JBoss JIRA] Commented: (JBRULES-389) Use of "exists" causes a ClassCastException

Edson Tirelli (JIRA) jira-events at jboss.com
Sat Aug 5 17:54:12 EDT 2006


    [ http://jira.jboss.com/jira/browse/JBRULES-389?page=comments#action_12340700 ] 
            
Edson Tirelli commented on JBRULES-389:
---------------------------------------

  * Removing cache to avoid problems with out-of-date cache value
  * Updating testcases

------------ TRUNK:
$ svn commit drools-core/src/main/java/org/drools/rule/VariableRestriction.java drools-core/src/main/java/org/drools/rule/VariableConstraint.java drools-compiler/src/test/java/org/drools/reteoo/ReteooBuilderTest.java drools-compiler/src/test/resources/org/drools/reteoo/OneAndTwoOrs drools-compiler/src/test/resources/org/drools/reteoo/OneAndTwoOrsPerson drools-compiler/src/test/resources/org/drools/reteoo/ThreeColumnsWithConstraints
Sending        drools-compiler/src/test/java/org/drools/reteoo/ReteooBuilderTest.java
Sending        drools-compiler/src/test/resources/org/drools/reteoo/OneAndTwoOrs
Sending        drools-compiler/src/test/resources/org/drools/reteoo/OneAndTwoOrsPerson
Sending        drools-compiler/src/test/resources/org/drools/reteoo/ThreeColumnsWithConstraints
Sending        drools-core/src/main/java/org/drools/rule/VariableConstraint.java
Sending        drools-core/src/main/java/org/drools/rule/VariableRestriction.java
Transmitting file data ......
Committed revision 5498.

----------- 3.0.x branch:
$ svn commit drools-core/src/main/java/org/drools/rule/BoundVariableConstraint.java
Sending        drools-core/src/main/java/org/drools/rule/BoundVariableConstraint.java
Transmitting file data .
Committed revision 5500.


> Use of "exists" causes a ClassCastException
> -------------------------------------------
>
>                 Key: JBRULES-389
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-389
>             Project: JBoss Rules
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Reteoo
>    Affects Versions: 3.0.3
>            Reporter: Edson Tirelli
>         Assigned To: Edson Tirelli
>             Fix For: 3.0.4
>
>
> Using exists with later bound variables will cause ClassCastException.
> package com.sample
> import org.drools.Cheese
> import org.drools.Person
> global java.util.List results
> rule "Exists with Bindings"	
> 	when
> 		exists Cheese()
> 		c: Cheese( $type : type );
> 		p: Person( likes == $type );
> 	then 
> 		results.add( $type );		
> end
> Results in:
> java.lang.ClassCastException: org.drools.reteoo.InitialFactImpl
> 	at org.drools.base.org.drools.Cheese$getType.getValue(Unknown Source)
> 	at org.drools.base.ClassFieldExtractor.getValue(ClassFieldExtractor.java:79)
> 	at org.drools.rule.Declaration.getValue(Declaration.java:156)
> 	at org.drools.rule.BoundVariableConstraint.isAllowed(BoundVariableConstraint.java:82)
> 	at org.drools.common.BetaNodeBinder.isAllowed(BetaNodeBinder.java:63)
> 	at org.drools.reteoo.TupleSource.attemptJoin(TupleSource.java:99)
> 	at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:165)
> 	at org.drools.reteoo.ObjectSource.propagateAssertObject(ObjectSource.java:119)
> 	at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:158)
> 	at org.drools.reteoo.Rete.assertObject(Rete.java:120)
> 	at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:180)
> 	at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(ReteooWorkingMemory.java:69)
> 	at org.drools.common.AbstractWorkingMemory.assertObject(AbstractWorkingMemory.java:538)
> 	at org.drools.common.AbstractWorkingMemory.assertObject(AbstractWorkingMemory.java:374)
> 	at org.drools.integrationtests.IntegrationCases.testExistsWithBinding(IntegrationCases.java:2608)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

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