<br>&nbsp;&nbsp; Really? That is a surprise to me... we need to handle that...<br><br>&nbsp;&nbsp; Maybe you can open a JIRA for us?<br><br>&nbsp;&nbsp; Thanks,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/5/6 Alessandro Lazarotti &lt;<a href="mailto:alessandro@siq.com.br">alessandro@siq.com.br</a>&gt;:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thanks Michael, I simulate.. your rule fire with successful.<br>
<br>
I discovered the problem. The object in property (like Foo in your example), when null, it&#39;s not throws NullPointerException, but &quot;org.mvel.PropertyAccessException: unable to resolve property&quot;.<br>
With that, I never imagined that the problem was nullPointer, but I thought about any access visibility (duh!).<br>
<br>
[]&#39;s<br>
Alessandro<br>
<br>
<br>
<br>
Michael B. escreveu:<div><div></div><div class="Wj3C7c"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Okay, I wrote a test case around the following and it works fine so let me<br>
know if this isnt what you are working with...<br>
<br>
Foo Class<br>
<br>
public class Foo {<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private String m_name;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public String getName()<br>
 &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp;return m_name; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public void setName(String nm)<br>
 &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp;m_name = nm;<br>
 &nbsp; &nbsp;}<br>
<br>
}<br>
<br>
<br>
Bar Class<br>
<br>
public class Bar {<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private Foo m_foo;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public Foo getFoo()<br>
 &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp;return m_foo;<br>
 &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public void setFoo(Foo f)<br>
 &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp;m_foo = f;<br>
 &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public String toString()<br>
 &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp;return &quot;I have a foo with a name of &quot; + m_foo.getName();<br>
 &nbsp; &nbsp;}<br>
<br>
}<br>
<br>
DRL Rule<br>
<br>
rule &quot;FooBar Rule&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$bar : Bar( <a href="http://foo.name" target="_blank">foo.name</a> != &quot;Wrong&quot; )<br>
 &nbsp; &nbsp; &nbsp; &nbsp;then  &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Test Successful - &quot; + $bar.toString());<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
end<br>
<br>
<br>
Junit Test Case<br>
<br>
 &nbsp; &nbsp;public void testProperties()  &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp;try<br>
 &nbsp; &nbsp; &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;final Reader source = new InputStreamReader(<br>
FooBarTest.class.getResourceAsStream( &quot;FooBar.drl&quot; ) );<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RuleBase ruleBase = RuleBaseFactory.newRuleBase();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PackageBuilder builder = new PackageBuilder();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;builder.addPackageFromDrl(source);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ( builder.hasErrors() ) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println( builder.getErrors().toString() );<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;throw new RuntimeException( &quot;Unable to compile<br>
\&quot;FooBar.drl\&quot;.&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//get the compiled package (which is serializable)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;final Package pkg = builder.getPackage();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//add the package to a rulebase (deploy the rule package).<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ruleBase.addPackage( pkg );<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;final StatefulSession session = ruleBase.newStatefulSession();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Foo foo = new Foo();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;foo.setName(&quot;Test&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bar bar = new Bar();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bar.setFoo(foo);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.insert(bar);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.fireAllRules(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp;catch (Exception e)<br>
 &nbsp; &nbsp; &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(e.getMessage());<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fail(e.getMessage());<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
<br>
 &nbsp; &nbsp;}<br>
<br>
<br>
<br>
<br>
 &nbsp;<br>
</blockquote></div></div><div><div></div><div class="Wj3C7c">
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>