[jboss-jira] [JBoss JIRA] (DROOLS-856) Regression for "special DRL operator" matches on 6.2.0.Final

Matteo Mortari (JIRA) issues at jboss.org
Thu Jul 23 10:58:04 EDT 2015


Matteo Mortari created DROOLS-856:
-------------------------------------

             Summary: Regression for "special DRL operator" matches on 6.2.0.Final
                 Key: DROOLS-856
                 URL: https://issues.jboss.org/browse/DROOLS-856
             Project: Drools
          Issue Type: Bug
    Affects Versions: 6.2.0.Final
         Environment: Works fine on 6.1.0.Final, but breaks at runtime with 6.2.0.Final - compilation with 6.2.0.Final is OK, just runtime breaks
            Reporter: Matteo Mortari
            Assignee: Mark Proctor


This is affecting at least the {{matches}} operator but could it also have further impacts, up to you to evaluate =) I hope is helpful case. I will attach reproducer.

Assume the following rules :
{code}
rule "color measure wrap"
salience 1000
no-loop
when
	$m : Measurement( id == "color" ) 
then
	AWrapper aw = new AWrapper($m);
	retract($m);
	insert(aw);
end

rule "wrapper matches"
salience 999
no-loop
when
	AWrapper ( $val : m.dataVal() , $val matches "#......" )
then
	System.out.println("I've matched an actual color, "+$val);
end
{code}



This passes the rule-compilation stage OK on both 6.1.0.Final and 6.2.0.Final of the kie-maven-plugin for instance, but breaks at runtime with 6.2.0.Final with the following stacktrace:
{code}
[INFO] --- kie-maven-plugin:6.2.0.Final:build (default-build) @ exercise-matches620f ---
[INFO] Adding KieModule from resource: FileResource[file=C:\eclipse44sr2\workspace-puredrools\exercise-matches620F\exercise-matches620f\src\main\resources]
[WARNING] Unable to find pom.properties in /C:/eclipse44sr2/workspace-puredrools/exercise-matches620F/exercise-matches620f/src/main/resources
[INFO] Recursed up folders,  found and used pom.xml C:\eclipse44sr2\workspace-puredrools\exercise-matches620F\exercise-matches620f\pom.xml
[INFO] KieModule was added: FileKieModule[releaseId=com.acme:exercise-matches620f:0.0.1-SNAPSHOT,file=C:\eclipse44sr2\workspace-puredrools\exercise-matches620F\exercise-matches620f\src\main\resources]
[INFO] KieModule successfully built!

(...)

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.acme.exercise_matches620f.RuleTest
16:52:39,455 INFO  [ClasspathKieProject] (main) Found kmodule: file:/C:/eclipse44sr2/workspace-puredrools/exercise-matches620F/exercise-matches620f/target/classes/META-INF/kmodule.xml
16:52:39,673 WARN  [ClasspathKieProject] (main) Unable to find pom.properties in /C:/eclipse44sr2/workspace-puredrools/exercise-matches620F/exercise-matches620f/target/classes
16:52:39,682 INFO  [ClasspathKieProject] (main) Recursed up folders,  found and used pom.xml C:\eclipse44sr2\workspace-puredrools\exercise-matches620F\exercise-matches620f\pom.xml
16:52:39,688 INFO  [KieRepositoryImpl] (main) KieModule was added: FileKieModule[releaseId=com.acme:exercise-matches620f:0.0.1-SNAPSHOT,file=C:\eclipse44sr2\workspace-puredrools\exercise-matches620F\exercise-matches620f\target\classes]
16:52:40,572 INFO  [RuleTest] (main) Creating kieBase with STREAM option
16:52:40,776 INFO  [RuleTest] (main) There should be rules: 
16:52:40,776 INFO  [RuleTest] (main) kp [Package name=com.acme.exercise_matches620f] rule color measure wrap
16:52:40,777 INFO  [RuleTest] (main) kp [Package name=com.acme.exercise_matches620f] rule wrapper matches
16:52:40,777 INFO  [RuleTest] (main) Creating kieSession
16:52:40,834 INFO  [RuleTest] (main) Now running data
16:52:40,865 DEBUG [RuleTest] (main) insert _ Measurement [id=color, val=red]
16:52:40,869 DEBUG [RuleTest] (main) delete Measurement [id=color, val=red] _
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.519 sec <<< FAILURE! - in com.acme.exercise_matches620f.RuleTest
test(com.acme.exercise_matches620f.RuleTest)  Time elapsed: 1.464 sec  <<< ERROR!
org.kie.api.runtime.rule.ConsequenceException: Exception executing consequence for rule "color measure wrap" in com.acme.exercise_matches620f: [Error: unable to resolve method: com.acme.exercise_matches620f.AWrapper.$val() [arglength=0]]
[Near : {... $val ~= "#......" ....}]
             ^
[Line: 1, Column: 1]
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1094)
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1003)
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:693)
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(ReflectiveAccessorOptimizer.java:488)
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:393)
	at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:163)
	at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
	at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
	at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:38)
	at org.mvel2.ast.RegExMatch.getReducedValueAccelerated(RegExMatch.java:71)
	at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
	at org.mvel2.MVEL.executeExpression(MVEL.java:930)
	at org.drools.core.util.MVELSafeHelper$RawMVELEvaluator.executeExpression(MVELSafeHelper.java:481)
	at org.drools.core.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:77)
	at org.drools.core.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:62)
	at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:230)
	at org.drools.core.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:187)
	at org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
	at org.drools.core.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:60)
	at org.drools.core.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:290)
	at org.drools.core.reteoo.EntryPointNode.assertObject(EntryPointNode.java:253)
	at org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:370)
	at org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:289)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:1480)
	at org.drools.core.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:229)
	at org.drools.core.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:223)
	at com.acme.exercise_matches620f.Rule_color_measure_wrap953168251.defaultConsequence(Rule_color_measure_wrap953168251.java:9)
	at com.acme.exercise_matches620f.Rule_color_measure_wrap953168251DefaultConsequenceInvokerGenerated.evaluate(Unknown Source)
	at com.acme.exercise_matches620f.Rule_color_measure_wrap953168251DefaultConsequenceInvoker.evaluate(Unknown Source)
	at org.drools.core.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1114)
	at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:160)
	at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:108)
	at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1016)
	at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1302)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1289)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1262)
	at com.acme.exercise_matches620f.RuleTest.test(RuleTest.java:92)


Results :

Tests in error: 
  RuleTest.test:92 » Consequence Exception executing consequence for rule "color...

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
{code}



While work OK with 6.1.0.Final:
{code}
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.acme.exercise_matches620f.RuleTest
16:41:26,432 INFO  [ClasspathKieProject] (main) Found kmodule: file:/C:/eclipse44sr2/workspace-puredrools/exercise-matches620F/exercise-matches620f/target/classes/META-INF/kmodule.xml
16:41:26,512 WARN  [ClasspathKieProject] (main) Unable to find pom.properties in /C:/eclipse44sr2/workspace-puredrools/exercise-matches620F/exercise-matches620f/target/classes
16:41:26,522 INFO  [ClasspathKieProject] (main) Recursed up folders,  found and used pom.xml C:\eclipse44sr2\workspace-puredrools\exercise-matches620F\exercise-matches620f\pom.xml
16:41:26,529 INFO  [KieRepositoryImpl] (main) KieModule was added:FileKieModule[ ReleaseId=com.acme:exercise-matches620f:0.0.1-SNAPSHOTfile=C:\eclipse44sr2\workspace-puredrools\exercise-matches620F\exercise-matches620f\target\classes]
16:41:27,327 INFO  [RuleTest] (main) Creating kieBase with STREAM option
16:41:27,523 INFO  [RuleTest] (main) There should be rules: 
16:41:27,523 INFO  [RuleTest] (main) kp [Package name=com.acme.exercise_matches620f] rule color measure wrap
16:41:27,523 INFO  [RuleTest] (main) kp [Package name=com.acme.exercise_matches620f] rule wrapper matches
16:41:27,523 INFO  [RuleTest] (main) Creating kieSession
16:41:27,579 INFO  [RuleTest] (main) Now running data
16:41:27,613 DEBUG [RuleTest] (main) insert _ Measurement [id=color, val=red]
16:41:27,617 DEBUG [RuleTest] (main) delete Measurement [id=color, val=red] _
16:41:27,622 DEBUG [RuleTest] (main) insert _ com.acme.exercise_matches620f.AWrapper at 35a9782c
I've matched an actual color, #FF0000
16:41:27,625 DEBUG [RuleTest] (main) insert _ Measurement [id=color, val=green]
16:41:27,626 DEBUG [RuleTest] (main) delete Measurement [id=color, val=green] _
16:41:27,626 DEBUG [RuleTest] (main) insert _ com.acme.exercise_matches620f.AWrapper at 71cf1b07
I've matched an actual color, #00FF00
16:41:27,626 DEBUG [RuleTest] (main) insert _ Measurement [id=color, val=blue]
16:41:27,626 DEBUG [RuleTest] (main) delete Measurement [id=color, val=blue] _
16:41:27,627 DEBUG [RuleTest] (main) insert _ com.acme.exercise_matches620f.AWrapper at 4aa83f4f
I've matched an actual color, #0000FF
16:41:27,627 INFO  [RuleTest] (main) Final checks
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.42 sec - in com.acme.exercise_matches620f.RuleTest

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)



More information about the jboss-jira mailing list