Implicit binding and "or" CE in pattern cause ClassCastException
----------------------------------------------------------------
Key: JBRULES-2321
URL:
https://jira.jboss.org/jira/browse/JBRULES-2321
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.7
Reporter: Tihomir Surdilovic
Assignee: Mark Proctor
This is a problem with Drools 4.0.7, it does not happen in Drools 5:
$factB.f1 is triggering a scenario where the engine creates an implicit biding to the
"f1" field.
That in conjunction with the use of "or" is triggering the problem
rule "implicit bindings test"
when
FactA()
$factB : FactB( $fB : f1 )
(not FactC( f1 == $factB.f1 ) or FactC() )
then
end
The exception thrown is:
java.lang.ClassCastException: com.sample.FactAShadowProxy cannot be cast to
com.sample.FactB
at org.drools.base.com.sample.FactB1865721816$getF1.getIntValue(Unknown Source)
at
org.drools.base.extractors.BaseIntClassFieldExtractor.getHashCode(BaseIntClassFieldExtractor.java:85)
at org.drools.base.ClassFieldExtractor.getHashCode(ClassFieldExtractor.java:225)
at org.drools.rule.Declaration.getHashCode(Declaration.java:273)
at org.drools.util.AbstractHashTable$SingleIndex.hashCodeOf(AbstractHashTable.java:533)
at org.drools.util.TupleIndexHashTable.getOrCreate(TupleIndexHashTable.java:315)
at org.drools.util.TupleIndexHashTable.add(TupleIndexHashTable.java:227)
at org.drools.reteoo.NotNode.assertTuple(NotNode.java:93)
at
org.drools.reteoo.CompositeTupleSinkAdapter.propagateAssertTuple(CompositeTupleSinkAdapter.java:30)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:156)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
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:911)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:684)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira