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

David Hill (JIRA) jira-events at lists.jboss.org
Wed Oct 29 00:17:21 EDT 2008


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