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

Literal constraint using 'null' triggers a NPE.

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.0.4
    • Fix Version/s: 3.0.5
    • Component/s: None
    • Labels:
      None
    • Environment:

      Windows XP SP2.

      Description

      The following triggers the problem:

      rule "Drops null results"
      when
      $result: Result(value == null)
      then
      retract($result);
      end

      Stack trace:
      java.lang.NullPointerException
      at org.drools.base.evaluators.ArrayFactory$ArrayEqualEvaluator.evaluate(Unknown Source)
      at org.drools.rule.LiteralConstraint.isAllowed(Unknown Source)
      at org.drools.reteoo.AlphaNode.assertObject(Unknown Source)
      at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source)
      at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown Source)
      at org.drools.reteoo.Rete.assertObject(Unknown Source)
      at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source)
      at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown Source)
      at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source)
      at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source)
      at org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown Source)
      at org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown Source)
      at org.rvpf.rules.ServiceProviderTests.testStatelessSession(ServiceProviderTests.java:130)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:552)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:411)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:785)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:114)
      at org.testng.TestRunner.privateRun(TestRunner.java:695)
      at org.testng.TestRunner.run(TestRunner.java:574)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:241)
      at org.testng.SuiteRunner.run(SuiteRunner.java:145)
      at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:901)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:863)
      at org.testng.TestNG.run(TestNG.java:613)
      at org.rvpf.tests.FrameworkTests.main(FrameworkTests.java:132)

      The following is a successful work-around:

      rule "Drops null results"
      when
      $result: Result()
      eval($result.getValue() == null)
      then
      retract($result);
      end

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                tirelli Edson Tirelli
                Reporter:
                sfbriss Serge Brisson
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: