[
https://issues.redhat.com/browse/DROOLS-5386?page=com.atlassian.jira.plug...
]
Toshiya Kobayashi updated DROOLS-5386:
--------------------------------------
Description:
This rule fails with PATTERN_DSL
{noformat}
rule R when
accumulate (
$p : Person(), $result : sum( MyUtil.add($p.getAge(), 10) ) )
then
insert($result);
end
{noformat}
It generates a lambda with duplicated parameters "_this" and "$p"
which are the same Pattern input bind variable.
{code:java}
org.drools.model.Rule rule =
D.rule("R").build(D.accumulate(D.pattern(var_$p).bind(var_C6D512FA5D3AACA24A83BF1EE132C0B2,
var_$p,
(_this,
$p) -> MyUtil.add($p.getAge(),10)),
{code}
So fails at runtime
{noformat}
[ERROR]
testAccumulateStaticMethodWithPatternBindVar[PATTERN_DSL](org.drools.modelcompiler.AccumulateTest)
Time elapsed: 3.151 s <<< ERROR!
java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: Array index out of
range: 1
at org.drools.core.rule.SingleAccumulate.accumulate(SingleAccumulate.java:105)
at org.drools.core.phreak.PhreakAccumulateNode.addMatch(PhreakAccumulateNode.java:714)
at
org.drools.core.phreak.PhreakAccumulateNode.doLeftInserts(PhreakAccumulateNode.java:168)
at org.drools.core.phreak.PhreakAccumulateNode.doNode(PhreakAccumulateNode.java:89)
at
org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:583)
at
org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:554)
at org.drools.core.phreak.RuleNetworkEvaluator.evalNode(RuleNetworkEvaluator.java:381)
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:341)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:177)
at
org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:135)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:213)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:88)
at
org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:33)
at
org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43)
at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1101)
at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1048)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1040)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1336)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1327)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1311)
at
org.drools.modelcompiler.AccumulateTest.testAccumulateStaticMethodWithPatternBindVar(AccumulateTest.java:2058)
...
Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
at org.drools.model.view.BindViewItem2.eval(BindViewItem2.java:89)
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:146)
at
org.drools.modelcompiler.constraints.LambdaAccumulator.accumulate(LambdaAccumulator.java:86)
at org.drools.core.rule.SingleAccumulate.accumulate(SingleAccumulate.java:97)
... 53 more
{noformat}
was:
This rule fails with PATTERN_DSL
{noformat}
rule R when
accumulate (
$p : Person(), $result : sum( MyUtil.add($p.getAge(), 10) ) )
then
insert($result);
end
{noformat}
Accumulate with static method with pettern bind variable
--------------------------------------------------------
Key: DROOLS-5386
URL:
https://issues.redhat.com/browse/DROOLS-5386
Project: Drools
Issue Type: Bug
Components: executable model
Affects Versions: 7.38.0.Final
Reporter: Toshiya Kobayashi
Assignee: Toshiya Kobayashi
Priority: Major
This rule fails with PATTERN_DSL
{noformat}
rule R when
accumulate (
$p : Person(), $result : sum( MyUtil.add($p.getAge(), 10) ) )
then
insert($result);
end
{noformat}
It generates a lambda with duplicated parameters "_this" and "$p"
which are the same Pattern input bind variable.
{code:java}
org.drools.model.Rule rule =
D.rule("R").build(D.accumulate(D.pattern(var_$p).bind(var_C6D512FA5D3AACA24A83BF1EE132C0B2,
var_$p,
(_this, $p) -> MyUtil.add($p.getAge(),10)),
{code}
So fails at runtime
{noformat}
[ERROR]
testAccumulateStaticMethodWithPatternBindVar[PATTERN_DSL](org.drools.modelcompiler.AccumulateTest)
Time elapsed: 3.151 s <<< ERROR!
java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: Array index out of
range: 1
at org.drools.core.rule.SingleAccumulate.accumulate(SingleAccumulate.java:105)
at org.drools.core.phreak.PhreakAccumulateNode.addMatch(PhreakAccumulateNode.java:714)
at
org.drools.core.phreak.PhreakAccumulateNode.doLeftInserts(PhreakAccumulateNode.java:168)
at org.drools.core.phreak.PhreakAccumulateNode.doNode(PhreakAccumulateNode.java:89)
at
org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:583)
at
org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:554)
at org.drools.core.phreak.RuleNetworkEvaluator.evalNode(RuleNetworkEvaluator.java:381)
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:341)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:177)
at
org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:135)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:213)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:88)
at
org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:33)
at
org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43)
at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1101)
at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1048)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1040)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1336)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1327)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1311)
at
org.drools.modelcompiler.AccumulateTest.testAccumulateStaticMethodWithPatternBindVar(AccumulateTest.java:2058)
...
Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
at org.drools.model.view.BindViewItem2.eval(BindViewItem2.java:89)
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:146)
at
org.drools.modelcompiler.constraints.LambdaAccumulator.accumulate(LambdaAccumulator.java:86)
at org.drools.core.rule.SingleAccumulate.accumulate(SingleAccumulate.java:97)
... 53 more
{noformat}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)