Hi, all:
I meet a strange error when use "contains" operator on string type, My rule is like below:
package org.drools.examples;
import org.drools.examples.HelloWorldExample.Message;
rule "check str contains"
dialect "java"
when
m:Message( message contains "Hello" )
then
System.out.println( "===check str contains ok===" );
end
Exception in thread "main" java.lang.RuntimeException: Operator 'Operator = 'contains'' does not exist for StringEvaluatorBut if I use a "deep" str field, this issue does not exist, Everything goes well.
at org.drools.base.evaluators.StringFactory.getEvaluator(StringFactory.java:70)
at org.drools.base.ValueType.getEvaluator(ValueType.java:166)
at org.drools.rule.builder.PatternBuilder.getEvaluator(PatternBuilder.java:900)
at org.drools.rule.builder.PatternBuilder.buildRestriction(PatternBuilder.java:714)
at org.drools.rule.builder.PatternBuilder.buildRestriction(PatternBuilder.java:625)
at org.drools.rule.builder.PatternBuilder.createRestriction(PatternBuilder.java:434)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:308)
at org.drools.rule.builder.PatternBuilder.buildConstraint(PatternBuilder.java:199)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:168)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:93)
at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:69)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:53)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)
at org.drools.examples.HelloWorldExample.main(HelloWorldExample.java:28)
package org.drools.examples;
import org.drools.examples.HelloWorldExample.Message;
rule "check deep str contains"
dialect "java"
when
m:Message( sec.fir.msg contains "Hello" )
then
System.out.println( "===check deep str contains ok===" );
end
antlr-runtime-3.0.jar
core-3.2.3.v_686_R32x.jar
drools-compiler-4.0.7.jar
drools-core-4.0.7.jar
drools-decisiontables-4.0.7.jar
drools-jsr94-4.0.7.jar
janino-2.5.10.jar
jsr94-1.1.jar
mvel-1.3.12-java1.4.2.jar
Can everyone kindly give me any suggestion?