<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:st="&#1;" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="Street"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="address"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="country-region" downloadurl="http://www.5iantlavalamp.com/"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place" downloadurl="http://www.5iantlavalamp.com/"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-GB link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks for replying. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-IE style='font-size:10.0pt;font-family:"Courier New"'>rule &quot;Player
1 wins first set &quot; <o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-IE style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; when<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-IE style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $f : Fact()<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><font size=2
face="Courier New"><span lang=EN-IE style='font-size:10.0pt;font-family:"Courier New"'>eval
($f.getDetails().get(&quot;END_SET&quot;).toString() == &quot;true&quot;
&amp;&amp; </span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";background:white'>Integer.valueOf($f.getDetails().get(&quot;SET&quot;).toString())
</span></font><font size=2 face="Courier New"><span lang=EN-IE
style='font-size:10.0pt;font-family:"Courier New"'>== 1 &amp;&amp; Integer.valueOf($f.getDetails().get(&quot;PLAYER1_SCORE&quot;).toString())
&gt; Integer.valueOf($f.getDetails().get(&quot;PLAYER2_SCORE&quot;).toString()))<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-IE style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; then<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-IE style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font
color=red><span style='color:red'>//then settle selection;<o:p></o:p></span></font></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-IE style='font-size:10.0pt;font-family:"Courier New"'>end<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>this rules runs perfectly as long as the
hashmap contained in the &#8216;fact&#8217; object has all the required keys and their
values are not null. For the time being I have just changed any null values to
a value of &#8216;DEFAULT&#8217; but it would be preferable to be able to look for </span></font><font
size=2 face="Courier New"><span lang=EN-IE style='font-size:10.0pt;font-family:
"Courier New"'>f.getDetails().get(&quot;END_SET&quot;) </span></font><font
size=2 color=navy face=Arial><span lang=EN-IE style='font-size:10.0pt;
font-family:Arial;color:navy'>(for example) knowing that the engine that sent
it might not be in an end_set state so may not have added that key. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-IE
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-IE
style='font-size:10.0pt;font-family:Arial;color:navy'>That example is very
basic but as I create more rules for more sports it could become very
cumbersome to have to ensure that every key referenced in the rules is in the
hashmap each time!<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-IE
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-IE
style='font-size:10.0pt;font-family:Arial;color:navy'>Alex </span></font><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'><o:p></o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span lang=EN-US
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span lang=EN-US style='font-size:10.0pt;font-family:Tahoma'>
rules-dev-bounces@lists.jboss.org [mailto:rules-dev-bounces@lists.jboss.org] <b><span
style='font-weight:bold'>On Behalf Of </span></b>David Sinclair<br>
<b><span style='font-weight:bold'>Sent:</span></b> 24 February 2009 17:27<br>
<b><span style='font-weight:bold'>To:</span></b> Rules Dev List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-dev] Dealing
with null pointer exceptions thrown by parsing rules</span></font><span
lang=EN-US><o:p></o:p></span></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>I understand what you are
saying Alex, but could you post an example rule to see exactly how you are
doing it? It may be that you could simply rewrite the rule so you don't get the
NPE.<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Tue, Feb 24, 2009 at 4:24 AM, Zevenbergen, Alex &lt;<a
href="mailto:azevenbergen@paddypower.com">azevenbergen@paddypower.com</a>&gt;
wrote:<o:p></o:p></span></font></p>

<div link=blue vlink=purple>

<div>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Hi
all,</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I
have started writing my rules packages and so have had a decent amount of
success. However all my rules are based on value pairs from a hashmap object
that is contained within my fact object. This approach works fine if the
parameter the rule is looking for is in the map and has a value.</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>But
I will need to be able to pass null values to the rules (and expect them to
just not fire any rule that looks for that param), however this always throws a
null pointer exception.</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>So
my question is: Is there any mechanism to deal with this in drools.</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Simply
setting all nulls to a default value isn&#8217;t preferable in this situation as the
app is going to be used by several different sources and has to be able to take
in many different types of info.</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Thanking
you,</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Alex</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
________________________________________________________________________<br>
Privileged, confidential and/or copyright information may be contained in this
communication. This e-mail and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they are
addressed. If you are not the intended addressee, you may not copy, forward,
disclose or otherwise use this e-mail or any part of it in any way whatsoever.
To do so is prohibited and may be unlawful. If you have received this email in
error <br>
please notify the sender immediately.<br>
<br>
Paddy Power PLC may monitor the content of e-mail sent and received for the
purpose of ensuring compliance with its policies and procedures.<br>
<br>
Paddy Power plc, Airton House, <st1:Street w:st="on"><st1:address w:st="on">Airton
  Road</st1:address></st1:Street>, Tallaght, <st1:City w:st="on">Dublin</st1:City>
24 Registered in <st1:country-region w:st="on"><st1:place w:st="on">Ireland</st1:place></st1:country-region>:
16956<br>
________________________________________________________________________<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>


<BR>
________________________________________________________________________<BR>
Privileged, confidential and/or copyright information may be contained in this communication. This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended addressee, you may not copy, forward, disclose or otherwise use this e-mail or any part of it in any way whatsoever. To do so is prohibited and may be unlawful. If you have received this email in error <BR>
please notify the sender immediately.<BR>
<BR>
Paddy Power PLC may monitor the content of e-mail sent and received for the purpose of ensuring compliance with its policies and procedures.<BR>
<BR>
Paddy Power plc, Airton House, Airton Road, Tallaght, Dublin 24  Registered in Ireland: 16956<BR>
________________________________________________________________________<BR>
</body>

</html>