]
Edson Tirelli closed JBRULES-1435.
----------------------------------
Fix Version/s: 4.0.5
5.0.0-M1
Resolution: Done
Could not reproduce the problem, but added the null checks anyway.
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
Affects Versions: 4.0.4
Environment: os x, jdk 1.5
Reporter: Alex McCarrier
Fix For: 4.0.5, 5.0.0-M1
Original Estimate: 0 minutes
Remaining Estimate: 0 minutes
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: