[
https://issues.jboss.org/browse/JBRULES-2979?page=com.atlassian.jira.plug...
]
Edson Tirelli resolved JBRULES-2979.
------------------------------------
Fix Version/s: 5.2.0.CR1
Resolution: Done
Joe, I missed that the old parser had COMMA as optional inside the accumulate statement
when re-writing the new parser. Although I think that was an "accident" in the
past, I changed the new parser to respect backward compatibility with optional commas.
Thanks for reporting.
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