[rules-users] Disabling strict mode in 5.4
Joe White
Joe.White at recondotech.com
Fri May 25 15:05:11 EDT 2012
The exception below is one of thousands like it. The problem is that the
data is coming from a Map and in strict mode mvel is unable to determine
the type. This rule works fine with strict mode off in 5.0.1 and 5.2.
The rule is:
rule "PEL_CHANGELIST_RES.AUTH.Actual First Name" extends
"PEL_CHANGELIST_RES.AUTH.Actual Person Base"
when
DalMap($existingValue : this['PERSON.FirstName'] != null) from
$existingPerson
DalMap($mergedValue : this['PERSON.FirstName'] != null) from
$mergedPerson
$lowerExisting : String() from $existingValue.toLowerCase()
String(this != $lowerExisting) from $mergedValue.toLowerCase()
then
$changeList.add(EncounterConsts.Episode.PersonRole.Person.path);
update($in);
end
-----Original Message-----
From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: Friday, May 25, 2012 12:43 PM
To: Rules Users List
Subject: Re: [rules-users] Disabling strict mode in 5.4
Line 3 of the error message suggests that the parser isn't able to
determine the type of $existingValue as java.lang.String. So, strict
or no strict, the problem might be in the rule. Show?
-W
On 25/05/2012, Joe White <Joe.White at recondotech.com> wrote:
> How do you disable strict mode in 5.4? We are using the code below and
> getting strict mode exceptions. It worked in prior versions. Do you
have
> to use the new APIs to disable strict mode?
>
>
>
>
>
> PackageBuilderConfiguration pkgBuilderCfg = new
> PackageBuilderConfiguration();
>
> MVELDialectConfiguration mvelConf = (MVELDialectConfiguration)
> pkgBuilderCfg.getDialectConfiguration( "mvel" );
>
> mvelConf.setStrict(false);
>
> mvelConf.setLangLevel(5);
>
> PackageBuilder builder = new PackageBuilder(pkgBuilderCfg);
>
> builder.addPackageFromDrl(new StringReader(drlString));
>
>
>
>
>
> An example exception:
>
> 1.
>
19:17:51,137|ERROR|drools.DroolsMgr|DroolsMgr.java|159|deployRulesFromMo
>
delForScope|org.apache.camel.spring.Main.main()|smf-rcp-SNAPSHOT|Failed
> to deploy rules from model
>
> 2. com.recondotech.hre.rules.management.HRERulesManagmentException:
> org.drools.rule.InvalidRulePackage: Unable to Analyse Expression
> $existingValue.toLowerCase():
>
> 3. [Error: unable to resolve method using strict-mode:
> java.lang.Object.toLowerCase()]
>
> 4. [Near : {... $existingValue.toLowerCase() ....}]
>
> 5. ^ : [Rule
> name='PEL_CHANGELIST_RES.AUTH.Actual First Name']
>
>
>
>
>
> Thanks
>
> Joe
>
>
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
More information about the rules-users
mailing list