[jboss-jira] [JBoss JIRA] Assigned: (JBRULES-1435) NPE if rule checks a Long field for null, and a fact is passed in with Long field that is NOT null.
Edson Tirelli (JIRA)
jira-events at lists.jboss.org
Tue Feb 19 16:52:27 EST 2008
[ http://jira.jboss.com/jira/browse/JBRULES-1435?page=all ]
Edson Tirelli reassigned JBRULES-1435:
--------------------------------------
Assignee: Edson Tirelli
> 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
> Assigned To: Edson Tirelli
> 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: 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