[jboss-jira] [JBoss JIRA] Created: (JBRULES-1435) NPE if rule checks a Long field for null, and a fact is passed in with Long field that is NOT null.
Alex McCarrier (JIRA)
jira-events at lists.jboss.org
Fri Jan 25 11:33:21 EST 2008
NPE if rule checks a Long field for null, and a fact is passed in with Long field that is NOT null.
---------------------------------------------------------------------------------------------------
Key: JBRULES-1435
URL: http://jira.jboss.com/jira/browse/JBRULES-1435
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.4
Environment: os x, jdk 1.5
Reporter: Alex McCarrier
If you have a fact class that has a field that is a Long:
class MyFact {
Long myField = new Long(0);
...
}
rule CheckMyField
when
MyFact(myField == null)
then
... do something about it ...
end
If you pass that fact into the engine you will get an NPE. The problem lies in the fact that when comparing a Long against null, it thinks that since the value passed in is not null and is a Long, the second value should also be not null. But since the rule says to check for null, it fails trying to throw a ClassCastException. Since the second value is null, it gets an NPE trying to generate the message saying that value (null) is not of class Long.
The problem is in org.drools.base.evaluators.ObjectFactory.ObjectEqualsComparator line 553. When arg0 is a Number it doesn't account for the possibility that arg1 might be null.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list