-
Bug
-
Resolution: Done
-
Major
-
7.46.0.Final
-
None
-
2021 Week 22-24 (from May 31)
-
2
-
Undefined
-
NEW
-
NEW
-
---
-
---
When a rule has a dynamic salience and the referenced variable can be a different Pattern because of Or,
for example)
rule r1 salience (f1.field2) when foo: Foo() ( Pet() and f1 : FactA( field1 == 'f1') ) or f1 : FactA(field1 == 'f2') then ...
results in
java.lang.NullPointerException at org.drools.core.reteoo.BaseLeftTuple.get(BaseLeftTuple.java:409) at org.drools.core.reteoo.BaseTuple.get(BaseTuple.java:131) at org.drools.modelcompiler.consequence.LambdaConsequence.declarationsToFacts(LambdaConsequence.java:99) at org.drools.modelcompiler.consequence.LambdaConsequence.declarationsToFacts(LambdaConsequence.java:79) at org.drools.modelcompiler.attributes.LambdaSalience.getValue(LambdaSalience.java:37) at org.drools.core.phreak.PhreakRuleTerminalNode.getSalienceValue(PhreakRuleTerminalNode.java:129)
DynamicAttributeEvaluator caches declarations so the declaration [f1] is always associated with the same pattern (e.g. the first FactA pattern so Pattern.objectIndex = 2). But when the second FactA pattern is evaluated, the tuple index is 1 so fails to get the correct fact from the tuple.
org.drools.mvel.integrationtests.ExecutionFlowControlTest in test-compiler-integration fails with some tests when executable-model is enabled. See TODO comment in the test class. Once fixed (or the test failure is justified), we can remove the TODO comment and let the test run with executable-model.
Currently, executable-model is disabled:
// TODO: .... return TestParametersUtil.getKieBaseCloudConfigurations(false);
If the test failure contains multiple bugs, we may split this JIRA into multiple JIRAs.
- is related to
-
DROOLS-5729 Reorganize drools unit tests
- Coding In Progress