<div>A rather debatable feature has been added: the automatic insertion of semicolons in MVEL code. The problem surfaces in several constellations where the naive algorithm thinks that a semicolon should be inserted, e.g., after the closing parenthesis of any structured statement (such as &quot;for&quot;, &quot;while&quot;, &quot;switch&quot;) whenever there is no opening brace following <i>on the same line</i>.</div>
<div><br></div><div>This feature ought to be off-turnable!</div><div><br></div><div>-W</div><br><br><div class="gmail_quote">On 11 April 2012 16:51, groovenarula <span dir="ltr">&lt;<a href="mailto:gnarula1@la-z-boy.com">gnarula1@la-z-boy.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I have a situation where I need to iterate over an ArrayList in the RHS of a<br>
rule. The ArrayList is created in the LHS of the rule as follows :<br>
<br>
rule &quot;Hello World&quot;<br>
dialect &quot;mvel&quot;<br>
        when<br>
                $cur    : Message()<br>
                $others : ArrayList ( size &gt; 0 ) from collect(Message(status ==<br>
$cur.status,  this != $cur ))<br>
        then<br>
                for ( int ctr = 0; ctr &lt; $others.size(); ctr++)<br>
                {<br>
                        System.out.println((Message) $others.get(ctr));<br>
                }<br>
end<br>
<br>
This works in Drools 5.1.1.<br>
<br>
However it gives the following parser error in Drools 5.2.X :<br>
<br>
      Unable to Analyse Expression for ( int ctr = 0; ctr &lt; $others.size();<br>
ctr++);<br>
                {<br>
                        System.out.println((Message) $others.get(ctr));<br>
                }               ;:<br>
      [Error: was expecting type: java.lang.Object; but found type:<br>
&lt;Unknown&gt;]<br>
      [Near : {... for ( int ctr = 0; ctr &lt; $othe ....}]<br>
                      ^<br>
      [Line: 6, Column: 0] : [Rule name=&#39;Hello World&#39;]<br>
<br>
      java.lang.IllegalArgumentException: Could not parse knowledge.<br>
              at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:50)<br>
              at com.sample.DroolsTest.main(DroolsTest.java:23)<br>
<br>
What am I missing here ? Any insight on a possible solution is appreciated.<br>
This has become a big stumbling block for us to move from 5.1.1 to 5.2.1.<br>
<br>
Thanks in advance,<br>
Gurvinder<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Drools-parser-error-accessing-ArrayList-tp3902766p3902766.html" target="_blank">http://drools.46999.n3.nabble.com/Drools-parser-error-accessing-ArrayList-tp3902766p3902766.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>