[jboss-jira] [JBoss JIRA] Created: (JBRULES-1001) NullPointerException when a function is used inside a predicate expression

Edgardo Carena (JIRA) jira-events at lists.jboss.org
Thu Jul 12 12:30:03 EDT 2007


NullPointerException when a function is used inside a predicate expression 
---------------------------------------------------------------------------

                 Key: JBRULES-1001
                 URL: http://jira.jboss.com/jira/browse/JBRULES-1001
             Project: JBoss Rules
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions:  4.0.0.MR3
            Reporter: Edgardo Carena
         Assigned To: Mark Proctor
            Priority: Minor


if you change the FibonacciExample like this:

(...)

import java.lang.Math;

function boolean approxEqual(double val1, double val2) {
    return (Math.abs(val1-val2)<0.01);
}

(....)

rule Calculate
        when
                f1 : Fibonacci( s1 : sequence, value != -1 )
                f2 : Fibonacci( s2 : sequence -> (approxEqual(sequence,(s1 + 1))), value != -1 )
                f3 : Fibonacci( sequence == (s2 + 1 ), value == -1 )
        then
                f3.setValue( f1.getValue() + f2.getValue() );
                update( f3 );
                retract( f1 );
                System.out.println( f3.getSequence() + " == " + f3.getValue() );
end

thus introducing a function inside a predicate expression, the example works well, however a NullPointerException is printed out during the call of the addPackageFromDrl method.

I tried in many examples, also calling directly the java.lang.Math.abs function, and the message is always printed with no apparent side effect.

-- 
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