]
Chris DeLashmutt updated JBRULES-2526:
--------------------------------------
Attachment: mvel-declarations-problem.zip
Attaching test case project.
org.drools.rule.InvalidPatternException: "Required Declarations
not bound" when using MVEL, and OR-ing evals together
----------------------------------------------------------------------------------------------------------------------
Key: JBRULES-2526
URL:
https://jira.jboss.org/browse/JBRULES-2526
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-core (expert)
Affects Versions: 5.1.0.CR1
Reporter: Chris DeLashmutt
Assignee: Mark Proctor
Attachments: mvel-declarations-problem.zip
There is an issue when using multiple groups of OR'd evals and the mvel dialect.
Drools is throwing an InvalidPatternException complaining that there are unbound
declarations. During tracing, it seems that the declaration was actually found, but
offset for the pattern that is resolved in BuildUtils.checkUnboundDeclarations() line: 239
isn't <= the offset of the pattern that was passed in with the declarations to the
method.
Here is the rule:
rule "MVEL with OR groups and Evals"
when
$fieldB: Field(name == "fieldB")
$fieldC: Field(name == "fieldC")
$fieldD: Field(name == "fieldD")
$fieldE: Field(name == "fieldE")
(
eval($fieldB != null)
|| eval($fieldC != null)
)
(
eval($fieldD != null)
|| eval($fieldE != null)
)
then
insert( new Result("Found") );
end
Here is the stack trace:
Thread [main] (Suspended (exception InvalidPatternException))
BuildUtils.checkUnboundDeclarations(BuildContext, Declaration[]) line: 258
EvalBuilder.build(BuildContext, BuildUtils, RuleConditionElement) line: 40
GroupElementBuilder$AndBuilder.build(BuildContext, BuildUtils, RuleConditionElement)
line: 130
GroupElementBuilder.build(BuildContext, BuildUtils, RuleConditionElement) line: 77
ReteooRuleBuilder.addSubRule(BuildContext, GroupElement, Rule) line: 155
ReteooRuleBuilder.addRule(Rule, InternalRuleBase, IdGenerator) line: 128
ReteooBuilder.addRule(Rule) line: 117
ReteooRuleBase.addRule(Rule) line: 409
ReteooRuleBase(AbstractRuleBase).addRule(Package, Rule) line: 638
ReteooRuleBase(AbstractRuleBase).addPackages(Collection<Package>) line: 520
ReteooRuleBase.addPackage(Package) line: 435
TestDeclarations.testDeclarations() line: 41
... (some stack removed for clarity)
RemoteTestRunner.main(String[]) line: 197
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: