Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-1001

NullPointerException when a function is used inside a predicate value constraint

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 4.0.0.GA
    • 4.0.0.MR3
    • None
    • None

    Description

      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 value constraint, 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.

      Attachments

        Activity

          People

            etirelli@redhat.com Edson Tirelli
            edddh Edgardo Carena (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Resolved:
              Archived:

              PagerDuty