[
https://issues.redhat.com/browse/DROOLS-5449?page=com.atlassian.jira.plug...
]
Matteo Casalino commented on DROOLS-5449:
-----------------------------------------
yes we noticed this. Still I thought this would be worth reporting because the fact that
it is only reproducible when iterating fireAllRules many times may hide some race
condition.
ClassCastException upon unreferenced declare update
---------------------------------------------------
Key: DROOLS-5449
URL:
https://issues.redhat.com/browse/DROOLS-5449
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 7.38.0.Final
Reporter: Matteo Casalino
Assignee: Mario Fusco
Priority: Major
Attachments: class-cast-exception-on-unreferenced-declare-update.zip
After updating a declared type that is not referenced in the rules with
_updateToVersion()_,
running _fireAllRules()_ many times in a loop throws _ClassCastException_.
E.g., when the following DRL:
{noformat}
declare UnreferencedType
x : int
end
declare ReferencedType
str : String
end
rule "example rule"
when
ReferencedType( str == "A" )
then
end{noformat}
is updated to:
{noformat}
declare UnreferencedType
x : int
newField : String
end
declare ReferencedType
str : String
end
rule "example rule"
when
ReferencedType( str == "A" )
then
end{noformat}
the following exception it thrown by _fireAllRules()_:
{noformat}
java.lang.RuntimeException: Error evaluating constraint 'str == "A"' in
[Rule "example rule" in org/example/rules.drl]
at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:277)
at org.drools.core.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:225)
at org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:139)
...
Caused by: java.lang.ClassCastException: class org.example.ReferencedType cannot be cast
to class org.example.ReferencedType (org.example.ReferencedType is in unnamed module of
loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader
@46292372; org.example.ReferencedType is in unnamed module of loader
org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @23b8d9f3)
at ConditionEvaluator7ed8b2c57cad4e74b856fdba30554aa1.evaluate(Unknown Source)
at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:275)
... 43 more{noformat}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)