Hi
I've inherited some old code running under 4.x of Drools. I'm investigating
use of 5.1.0 for newer development.
I was testing the old code base as is with drools 5.1.0 and got some
compilation issues on the DRL. Here is the sample drl snippet
package com.test.rule
import ...
rule "EmailVerificationCheck"
salience 500
when
context : RuleContext (paymentMethod == "P_EXPRESS")
eval (!context.isTrustedUser())
act : RuleAction (action == null || == "VERIFY")
then
if (act.getAction() == null) {
if(!context.isPEmailVerified()) {
act.setAction ("VERIFY");
}
}
if (act.getAction() == "VERIFY") {
if(!context.isPEmailVerified()) {
act.getRuleNames().add("PEmailVerificationCheck");
}
}
end
Compilation error is at eval (!context.isTrustedUser()) and the error
message is as follows -
org.drools.rule.InvalidRulePackage: Unable to generate rule invoker. :
org.drools.lang.descr.EvalDescr@1f8b158
com/playspan/rule/Rule_PayPal_EmailVerificationCheck_0Eval0Invoker.java
(16:48) : Redefinition of local variable "context"
at org.drools.rule.Package.checkValidity(Package.java:477)
~[drools-core-5.1.0.jar:5.1.0]
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:479)
~[drools-core-5.1.0.jar:5.1.0]
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:445)
~[drools-core-5.1.0.jar:5.1.0]
at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:452)
~[drools-core-5.1.0.jar:5.1.0]
at com.playspan.rule.RuleEngine.buildRuleBase(RuleEngine.java:374)
[classes/:na]
at com.playspan.rule.RuleEngine.initializeRuleSession(RuleEngine.java:384)
[classes/:na]
It is using java dialect and JANINO compiler.
I would really appreciate if some could point me to a direction for
troubleshooting this issue.
Is this construct invalid for 5.x onwards?
Thanks
Kumar