[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1827) comparing fact property to global causes NPE if global is set after the fact but before fireAllRules

Mark Proctor (JIRA) jira-events at lists.jboss.org
Fri Jan 16 02:33:04 EST 2009


    [ https://jira.jboss.org/jira/browse/JBRULES-1827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12448235#action_12448235 ] 

Mark Proctor commented on JBRULES-1827:
---------------------------------------

I have checked that on trunk, as part of the 5.0.0 release, that you won't get a null pointer now. The evaluation will just return false, unless of course the field is also null.

> comparing fact property to global causes NPE if global is set after the fact but before fireAllRules
> ----------------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-1827
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-1827
>             Project: JBoss Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core
>    Affects Versions: 4.0.7
>         Environment: Vista
>            Reporter: David Hill
>            Assignee: Mark Proctor
>
> This will cause an NPE prior to firing any rules, the NPE will occur at the workingMemory,insert statement.
> The workaround is to set the global before adding the Score fact.
> Java code:
> workingMemory.insert(new Score(1.23));  //has public Double named myScore initialized in constructor
> workingMemory.setGlobal("highPoint", 0.5);
> Drools code:
> global Double highPoint;
> rule "bootstrap1"
> when
>     $s : Score(myScore > highPoint);
> then
>     System.out.println("bootstrap1");
> end

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list