[jboss-jira] [JBoss JIRA] Created: (JBRULES-984) NullPointerException on conditions using contains evaluator when collection is null
Emily Harsh (JIRA)
jira-events at lists.jboss.org
Fri Jul 6 23:29:53 EDT 2007
NullPointerException on conditions using contains evaluator when collection is null
-----------------------------------------------------------------------------------
Key: JBRULES-984
URL: http://jira.jboss.com/jira/browse/JBRULES-984
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.0.MR3
Reporter: Emily Harsh
Assigned To: Mark Proctor
Rule condition is as follows:
myItem : MyItem( )
MyObject( myCollection contains myItem )
A NullPointerException is thrown when myCollection is null.
Proposed solution:
All evaluate* methods in org.drools.base.evaluators.ObjectFactory$ObjectContainsEvaluator need to have null checks surrounding the col.contains( value ) statements. For example, evaluateCachedLeft should be changed to:
public boolean evaluateCachedLeft(final VariableContextEntry context,
final Object right) {
final Object value = ((ObjectVariableContextEntry) context).left;
final Collection col = (Collection) context.extractor.getValue( right );
return col == null ? false : col.contains( value );
}
--
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