[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2102) Expert evaluate() does *not* throw NPE

Bjørn Erik Lømo (JIRA) jira-events at lists.jboss.org
Wed Jun 3 11:23:31 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBRULES-2102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12470443#action_12470443 ] 

Bjørn Erik Lømo commented on JBRULES-2102:
--------------------------------------------

In the aforementioned example, if both members are Integer objects, one of them being a nullpointer: If the right hand side of an Integer > Integer comparison is a nullpointer, drools throws a NPE. If the left hand side is null, it works fine. There's a check missing for null values on object2 in this function:

public boolean evaluate(InternalWorkingMemory workingMemory,
                                final InternalReadAccessor extractor1,
                                final Object object1,
                                final InternalReadAccessor extractor2, final Object object2) {
       if( extractor1.isNullValue( workingMemory, object1 ) ) {
                return false;
        }
        return extractor1.getIntValue( workingMemory, object1 ) > extractor2.getIntValue( workingMemory, object2 );
}

Etirelli can probably fill in the rest.

> Expert evaluate() does *not* throw NPE
> --------------------------------------
>
>                 Key: JBRULES-2102
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-2102
>             Project: JBoss Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 5.0.0.FINAL
>         Environment:  java 1.6.0_11, Ubuntu
>            Reporter: Travis Scheponik
>            Assignee: Edson Tirelli
>
> http://pastebin.com/m1dffefc4 <-- offending method within Expert
> example ObjectA( a:member1, b:member2, a > b)  <-- this crashes if b is null
> example: ObjectA(a:member1, b:member2, eval(a > b )) <-- afaik, this *should* crash  if a or b is null
> This was requested to be posted by: etirelli and bjornelo

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the jboss-jira mailing list