Hi,
I have a situation where I need to iterate over an ArrayList in the RHS of a
rule. The ArrayList is created in the LHS of the rule as follows :
rule "Hello World"
dialect "mvel"
when
$cur : Message()
$others : ArrayList ( size > 0 ) from collect(Message(status ==
$cur.status, this != $cur ))
then
for ( int ctr = 0; ctr < $others.size(); ctr++)
{
System.out.println((Message) $others.get(ctr));
}
end
This works in Drools 5.1.1.
However it gives the following parser error in Drools 5.2.X :
Unable to Analyse Expression for ( int ctr = 0; ctr < $others.size();
ctr++);
{
System.out.println((Message) $others.get(ctr));
} ;:
[Error: was expecting type: java.lang.Object; but found type:
<Unknown>]
[Near : {... for ( int ctr = 0; ctr < $othe ....}]
^
[Line: 6, Column: 0] : [Rule name='Hello World']
java.lang.IllegalArgumentException: Could not parse knowledge.
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:50)
at com.sample.DroolsTest.main(DroolsTest.java:23)
What am I missing here ? Any insight on a possible solution is appreciated.
This has become a big stumbling block for us to move from 5.1.1 to 5.2.1.
Thanks in advance,
Gurvinder
--
View this message in context:
http://drools.46999.n3.nabble.com/Drools-parser-error-accessing-ArrayList...
Sent from the Drools: User forum mailing list archive at
Nabble.com.