]
Luca Molteni reassigned DROOLS-4990:
------------------------------------
Assignee: Luca Molteni (was: Mario Fusco)
NullPointerException with executable model using accumulate max with
null Date field
------------------------------------------------------------------------------------
Key: DROOLS-4990
URL:
https://issues.redhat.com/browse/DROOLS-4990
Project: Drools
Issue Type: Bug
Components: core engine, executable model
Affects Versions: 7.32.0.Final
Reporter: Martin Weiler
Assignee: Luca Molteni
Priority: Major
Labels: support
Executing a rule containing accumulate max, eg:
{code}
rule AccumulateMaxDate
when
$max1 : Number() from accumulate(
StockTick(isSetDueDate == true
,$time : dueDate);
max($time.getTime().getTime()))
then
end
{code}
fails with a NPE at runtime if the StockDate.dueDate field is null:
{noformat}
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
{noformat}