[
https://jira.jboss.org/jira/browse/JBRULES-1827?page=com.atlassian.jira.p...
]
Mark Proctor closed JBRULES-1827.
---------------------------------
Resolution: Won't Fix
Field evaluation is done at insert time, any globals that are relied on must be set prior
to the insert. I see no other way around this.
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