[
https://issues.jboss.org/browse/DROOLS-600?page=com.atlassian.jira.plugin...
]
Stephanie Kroll commented on DROOLS-600:
----------------------------------------
As an aside, any chance of making FactTemplates part of the public API again? It is a
good feature and necessary when facts don't conform to the standard pattern.
ClassCastException when using FactTemplates
-------------------------------------------
Key: DROOLS-600
URL:
https://issues.jboss.org/browse/DROOLS-600
Project: Drools
Issue Type: Bug
Affects Versions: 6.1.0.Final
Reporter: Stephanie Kroll
Assignee: Mark Proctor
We have embedded Drools in our project and use FactTemplates. While attempting to
upgrade from Drools 5.3 to 6.1, we are receiving a ClassCastException in
org.drools.compiler.rule.builder.PatternBuilder when loading and compiling rules.
The problem is evident upon inspection of the code. In method build(RuleBuildContext,
BaseDescr, Pattern), the local var objectType can be either a FactTemplateObjectType or a
ClassObjectType, but line 258 does not check the type before attempting the cast.
{noformat}
java.lang.ClassCastException: org.drools.core.facttemplates.FactTemplateObjectType cannot
be cast to org.drools.core.base.ClassObjectType
at org.drools.compiler.rule.builder.PatternBuilder.build(PatternBuilder.java:258)
at org.drools.compiler.rule.builder.PatternBuilder.build(PatternBuilder.java:138)
at
org.drools.compiler.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:66)
at org.drools.compiler.rule.builder.RuleBuilder.build(RuleBuilder.java:89)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addRule(KnowledgeBuilderImpl.java:1652)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileRules(KnowledgeBuilderImpl.java:968)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileAllRules(KnowledgeBuilderImpl.java:844)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addPackage(KnowledgeBuilderImpl.java:838)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addPackageFromDrl(KnowledgeBuilderImpl.java:339)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addPackageFromDrl(KnowledgeBuilderImpl.java:315)
...{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)