[
https://issues.jboss.org/browse/JBRULES-2979?page=com.atlassian.jira.plug...
]
Mark Proctor commented on JBRULES-2979:
---------------------------------------
The exception on this is because result is returning null. I changed it to return a better
exception when result returns null.
However result was returning null because mvel is compiling the init/action wrong and
losing the local selIns var. That should now be fixed.
It did uncover an MVEL bug though, where it's not enforcing type safety on the addAll
method. Test case has been submitted to MVEL author.
Error in 5.2.0.M2 accumulate function. Works in 5.0 and 5.2.0.M1
----------------------------------------------------------------
Key: JBRULES-2979
URL:
https://issues.jboss.org/browse/JBRULES-2979
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 5.2.0.M2
Environment: Windows. Java 5.
Reporter: Joe White
Assignee: Edson Tirelli
Fix For: 5.2.0.CR1
Attachments: droolsTestAccums.zip
When loading the rule below the exception below occurs. The rule works and test passes in
5.0.1 and in 5.2.0.M1. A self contained unit test has been emailed to the development
team.
**********************Rule*************************************
package accumsTest
import java.util.Map;
import java.util.ArrayList;
dialect "mvel"
rule "Accum test rule"
salience 155
when
$episode: Map()
$commonVisits : ArrayList() from accumulate( Map( $selectedCv : this["KEY"]
!= null) from $episode
init(ArrayList selIns = new ArrayList();),
action(selIns.addAll($selectedCv);),
result(selIns)
)
then
System.out.println("HIT");
retract($episode);
end
****************************Exception********************************
[15,21]: [ERR 102] Line 15:21 mismatched input 'init' in rule "Accum test
rule"
java.lang.IllegalArgumentException: Could not parse knowledge.
at com.recondotech.droolsTest.AccumTest.readKnowledgeBase(AccumTest.java:40)
at com.recondotech.droolsTest.AccumTest.testUpdate(AccumTest.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira