-
Bug
-
Resolution: Done
-
Major
-
7.67.0.Final, 7.73.0.Final, 8.34.0.Final
-
None
-
2023 Week 06-08 (from Feb 6), 2023 Week 09-11 (from Feb 27)
-
2
-
NEW
-
NEW
-
---
-
---
*Consider Sample Rules*
rule "test id and name matches"
when
SomeDataHolder(id == anotherId, fullName == "lorem ipsum");
then
ruleResponse.add("lorem");
end
rule "test name matches"
when
SomeDataHolder(fullName == "dolor sit");
then
ruleResponse.add("dolor");
end
=====================================
*Test Input Parameters*
// Case 1: id and anotherId present
SomeDataHolder someDataHolder = new SomeDataHolder();
someDataHolder.setId(1234L);
someDataHolder.setAnotherId(1234L);
someDataHolder.setFullName("lorem ipsum");
// Case 2: id and anotherId both not present
SomeDataHolder someDataHolder = new SomeDataHolder();
someDataHolder.setFullName("dolor sit");
// Case 3: only id present (RHS null)
SomeDataHolder someDataHolder = new SomeDataHolder();
someDataHolder.setId(1234L);
someDataHolder.setFullName("dolor sit");
// Case 4: only anotherId present (LHS null)
SomeDataHolder someDataHolder = new SomeDataHolder();
someDataHolder.setAnotherId(1234L);
someDataHolder.setFullName("dolor sit");
=====================================
Using Drools 7.67.x or 8.32.0.Final there is a runtime exception:
[ERROR] Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.052 s <<< FAILURE! - in org.example.BrmsUpgradeTest
[ERROR] org.example.BrmsUpgradeTest.testMvelBehavior_Case3 Time elapsed: 0.043 s <<< FAILURE!
org.opentest4j.AssertionFailedError: Not supposed to fail even if RHS is null.
at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:39)
at org.junit.jupiter.api.Assertions.fail(Assertions.java:134)
at org.example.BrmsUpgradeTest.testMvelBehavior_Case3(BrmsUpgradeTest.java:62)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:55)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:223)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:175)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:139)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)
Actual exception is
org.drools.mvel.ConstraintEvaluationException: Error evaluating constraint 'id == anotherId' in [Rule "test id and name matches" in file0.drl] at org.drools.mvel.MVELConstraint.evaluate(MVELConstraint.java:287) at org.drools.mvel.MVELConstraint.isAllowed(MVELConstraint.java:235) at org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:134) at org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:745) at org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:598) at org.drools.core.reteoo.ObjectTypeNode.propagateAssert(ObjectTypeNode.java:297) at org.drools.core.phreak.PropagationEntry$Insert.propagate(PropagationEntry.java:162) at org.drools.core.phreak.PropagationEntry$Insert.execute(PropagationEntry.java:167) at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:100) at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:95) at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:853) at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:816) at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:808) at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1341) at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1332) at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1316) at org.drools.core.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:294) at org.example.BrmsUpgradeTest.executeRules(BrmsUpgradeTest.java:96) at org.example.BrmsUpgradeTest.testMvelBehavior_Case3(BrmsUpgradeTest.java:55) ... Caused by: java.lang.NullPointerException at org.mvel2.math.MathProcessor.toLong(MathProcessor.java:653) at org.mvel2.math.MathProcessor.doOperationsSameType(MathProcessor.java:494) at org.mvel2.math.MathProcessor._doOperations(MathProcessor.java:210) at org.mvel2.math.MathProcessor.doOperations(MathProcessor.java:78) at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:145) at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85) at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:115) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:111) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:105) at org.mvel2.MVEL.executeExpression(MVEL.java:946) at org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator.executeExpression(RawMVELEvaluator.java:103) at org.drools.mvel.expr.MvelEvaluator.internalEvaluate(MvelEvaluator.java:131) at org.drools.mvel.expr.MvelEvaluator.evaluate(MvelEvaluator.java:115) at org.drools.mvel.MVELConditionEvaluator.evaluate(MVELConditionEvaluator.java:121) at org.drools.mvel.MVELConditionEvaluator.evaluate(MVELConditionEvaluator.java:97) at org.drools.mvel.MVELConstraint.evaluate(MVELConstraint.java:285) ... 88 more
This issue happens with Integer, Long, Short, Float, Double. Also happens with BigInteger regardless of left side or right side.
This issue happens only with non-executable-model.
- is duplicated by
-
DROOLS-7321 Long comparisons are not null-safe anymore
- Resolved
- relates to
-
RHPAM-4642 NullPointerException in mvel MathProcessor with equality check when null property is on right side
- Closed