<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Thanks! Wolfgang<br><br>--- On <b>Sun, 28/8/11, Wolfgang Laun <i>&lt;wolfgang.laun@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Wolfgang Laun &lt;wolfgang.laun@gmail.com&gt;<br>Subject: Re: [rules-users] rule parse error for null check<br>To: "Rules Users List" &lt;rules-users@lists.jboss.org&gt;<br>Date: Sunday, 28 August, 2011, 11:33 PM<br><br><div id="yiv1926655114">See <a rel="nofollow" id="yiv1926655114key-val" target="_blank" href="https://issues.jboss.org/browse/JBRULES-3064">JBRULES-3064</a>, dialect "mvel" flouts generic parameters.<br><br>If you omit "&lt;String,Integer&gt;" after "new HashMap" all is well. Of course, this is another MVEL bug or restriction - who knows.<br>
<br>But don't try to work around this by <br><br>then<br><span style="color:rgb(183, 0, 0);">&nbsp;&nbsp; if</span>($u.subjectGradeMap == <span style="color:rgb(183, 0, 0);">null</span>){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $u.subjectGradeMap = <span style="color:rgb(183, 0, 0);">new</span> HashMap<b>/*&lt;String,Integer&gt;*/</b>();<br>
&nbsp;&nbsp; }<br><br>You'll just run into another MVEL bug.<br><br>-W<br><br><br><br><div class="yiv1926655114gmail_quote">2011/8/28 Neel <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:neeleshdev@yahoo.co.in" target="_blank" href="/mc/compose?to=neeleshdev@yahoo.co.in">neeleshdev@yahoo.co.in</a>&gt;</span><br>
<blockquote class="yiv1926655114gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family:inherit;font-style:inherit;font-variant:inherit;font-weight:inherit;font-size:inherit;line-height:inherit;font-size-adjust:inherit;font-stretch:inherit;" valign="top">
Hi,<div>I<span style="font-family:arial, helvetica, clean, sans-serif;border-collapse:collapse;line-height:15px;">'m using drools-5.3.0.Beta1.&nbsp;</span>I've following rule file:</div><div><br></div><div><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">
<span style="color:rgb(183, 0, 0);">import</span> java.util.*;</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;"><span style="color:rgb(183, 0, 0);"><br>
</span></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;"><span style="color:rgb(183, 0, 0);">declare</span> Student</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">&nbsp;&nbsp; name : String @key</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">&nbsp;&nbsp; subjectGradeMap : HashMap&nbsp; &nbsp;</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(183, 0, 0);">end</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;min-height:15px;">&nbsp;</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(0, 151, 0);"><span style="color:rgb(183, 0, 0);">rule</span><span style="color:rgb(0, 0, 0);"> </span>"Subject grade points"</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(183, 0, 0);">dialect<span style="color:rgb(0, 0, 0);"> </span><span style="color:rgb(0, 151, 0);">"mvel"</span></p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(183, 0, 0);">when</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">&nbsp;&nbsp; $u : Student()</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(183, 0, 0);">then</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">&nbsp;&nbsp; <span style="color:rgb(183, 0, 0);">if</span>($u.subjectGradeMap == <span style="color:rgb(183, 0, 0);">null</span>)</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">&nbsp;&nbsp; {</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">&nbsp; &nbsp; &nbsp; $u.subjectGradeMap = <span style="color:rgb(183, 0, 0);">new</span> HashMap&lt;String,Integer&gt;();</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">&nbsp;&nbsp; }</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">&nbsp;&nbsp; $u.subjectGradeMap[<span style="color:rgb(0, 151, 0);">"CompSc"</span>] += 100;</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;">&nbsp;&nbsp; System.out.println(<span style="color:rgb(0, 151, 0);">"Marks added"</span>);</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(183, 0, 0);">end</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(183, 0, 0);"><br></p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(183, 0, 0);"><span style="color:rgb(0, 0, 0);font-family:arial;font-size:13px;">I get following error while rule compilation:</span></p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(183, 0, 0);"></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">
Unable to Analyse Expression if($u.subjectGradeMap == null);</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">&nbsp;&nbsp; {</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">&nbsp; &nbsp; &nbsp; $u.subjectGradeMap = new HashMap&lt;String,Integer&gt;();</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">&nbsp;&nbsp; };</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">&nbsp;&nbsp; $u.subjectGradeMap["CompSc"] += 100;</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">&nbsp;&nbsp; System.out.println("Marks added");:</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">[Error: was expecting type: java.lang.Object; but found type: &lt;Unknown&gt;]</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">[Near : {... if($u.subjectGradeMap == null) ....}]</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;color:rgb(255, 0, 0);">[Line: 1, Column: 1] : [Rule name='Subject grade points']</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;min-height:15px;"><br></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;min-height:15px;">
<span style="font-family:arial;font-size:13px;">Please let me know if this is correct usage in the above scenario.</span></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;min-height:15px;">
<span style="font-family:arial;font-size:13px;"><br></span></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;min-height:15px;">
<span style="font-family:arial;font-size:13px;">Thanks,</span></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;min-height:15px;">
<span style="font-family:arial;font-size:13px;">Neel</span></p><font color="#888888"><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;min-height:15px;">
<span style="font-family:arial;font-size:13px;"><br></span></p></font></div></td></tr></tbody></table><br>_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="/mc/compose?to=rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>
</div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>rules-users mailing list<br><a ymailto="mailto:rules-users@lists.jboss.org" href="/mc/compose?to=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></div></blockquote></td></tr></table>