[jboss-jira] [JBoss JIRA] Assigned: (JBRULES-984) NullPointerException on conditions using contains evaluator when collection is null

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Sat Jul 14 11:44:04 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBRULES-984?page=all ]

Edson Tirelli reassigned JBRULES-984:
-------------------------------------

    Assignee: Edson Tirelli  (was: Mark Proctor)

> 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: Edson Tirelli
>         Attachments: ObjectFactory.java
>
>
> 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