Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-4525

NullPointerException in MatchesOperator with executable model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.26.0.Final
    • None

      A rule has the following constraint:

      $p : Person(likes matches "^[0-9]{3}.*$")
      

      If a Person object is inserted into the working memory with the likes field unset, this results in a NullPointerException when using the executable model:

      java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
      	at org.drools.modelcompiler.constraints.ConstraintEvaluator.evaluate(ConstraintEvaluator.java:77)
      	at org.drools.modelcompiler.constraints.LambdaConstraint.isAllowed(LambdaConstraint.java:108)
      	at org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:139)
      	at org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:501)
      	at org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:399)
      	at org.drools.core.reteoo.ObjectTypeNode.propagateAssert(ObjectTypeNode.java:324)
      	at org.drools.core.phreak.PropagationEntry$Insert.propagate(PropagationEntry.java:161)
      	at org.drools.core.phreak.PropagationEntry$Insert.execute(PropagationEntry.java:166)
      	at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:96)
      	at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:91)
      	at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1046)
      	at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1009)
      	at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1001)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1330)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1321)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1305)
      	at org.drools.modelcompiler.CompilerTest.testMatchesOnNullString(CompilerTest.java:2003)
      ...
      Caused by: java.lang.RuntimeException: java.lang.NullPointerException
      	at org.drools.model.DSL.eval(DSL.java:715)
      	at defaultpkg.RulesD6C04ACCB409930058C1DE751731F5EDRuleMethods0.lambda$rule_R2$8e86359d$1(RulesD6C04ACCB409930058C1DE751731F5EDRuleMethods0.java:39)
      	at org.drools.model.functions.Predicate1$Impl.test(Predicate1.java:18)
      	at org.drools.model.constraints.SingleConstraint1.lambda$getPredicate$8a56b796$1(SingleConstraint1.java:40)
      	at org.drools.modelcompiler.constraints.ConstraintEvaluator.evaluate(ConstraintEvaluator.java:73)
      	... 49 more
      Caused by: java.lang.NullPointerException
      	at org.drools.model.operators.MatchesOperator.eval(MatchesOperator.java:27)
      	at org.drools.model.operators.MatchesOperator.eval(MatchesOperator.java:21)
      	at org.drools.model.functions.Operator$SingleValue.test(Operator.java:41)
      	at org.drools.model.functions.Operator$SingleValue.test(Operator.java:39)
      	at org.drools.model.DSL.eval(DSL.java:713)
      	... 53 more
      

              mfusco@redhat.com Mario Fusco
              rhn-support-mputz Martin Weiler (Inactive)
              Tibor Zimányi Tibor Zimányi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: