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

NullPointerException with executable model using accumulate max with null Date field

XMLWordPrintable

      Executing a rule containing accumulate max, eg:

      rule AccumulateMaxDate
        when
        $max1 : Number() from accumulate(
        StockTick(isSetDueDate == true
              ,$time : dueDate);
             max($time.getTime().getTime()))
        then
        end
      

      fails with a NPE at runtime if the StockDate.dueDate field is null:

      Caused by: java.lang.NullPointerException
      	at defaultpkg.RulesA0DFC3D10EA29F3818B87E11918D8020RuleMethods0.lambda$rule_AccumulateMaxDate$c9e019d8$1(RulesA0DFC3D10EA29F3818B87E11918D8020RuleMethods0.java:34)
      	at org.drools.model.functions.Function1$Impl.apply(Function1.java:35)
      	at org.drools.model.view.BindViewItem1.eval(BindViewItem1.java:85)
      	at org.drools.modelcompiler.constraints.BindingEvaluator.evaluate(BindingEvaluator.java:39)
      	at org.drools.modelcompiler.constraints.BindingEvaluator.evaluate(BindingEvaluator.java:35)
      	at org.drools.modelcompiler.constraints.LambdaAccumulator$BindingAcc.getAccumulatedObject(LambdaAccumulator.java:154)
      	at org.drools.modelcompiler.constraints.LambdaAccumulator.accumulate(LambdaAccumulator.java:88)
      	at org.drools.core.rule.SingleAccumulate.accumulate(SingleAccumulate.java:97)
      	... 53 more
      

              lmolteni@redhat.com Luca Molteni
              rhn-support-mputz Martin Weiler (Inactive)
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: