]
Richard Calmbach updated JBRULES-3097:
--------------------------------------
Summary: [regression from 5.2.0.M1] Exception on RHS method call with null argument
(was: [regression from 5.2.0.M1] Exception on RHS method call with null parameter)
[regression from 5.2.0.M1] Exception on RHS method call with null
argument
--------------------------------------------------------------------------
Key: JBRULES-3097
URL:
https://issues.jboss.org/browse/JBRULES-3097
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-core
Affects Versions: 5.2.0.CR1
Reporter: Richard Calmbach
Assignee: Mark Proctor
At some point after Drools 5.2.0.M1, a bug was introduced that causes RHS method calls
with a null argument to throw an exception at runtime. The exception does not happen with
a non-null argument.
This still worked in Drools 5.2.0.M1 but breaks in Drools 5.2.0.CR1:
dialect "mvel"
rule "ruleA"
when
<lhs> (assigns $record, $id)
then
helper.methodWith3Parameters($record, $id, null);
end
Drools 5.2.0.CR1 throws the following exception at runtime (names sanitized). Note the
missing third argument in the "unable to resolve method" error message:
org.drools.runtime.rule.ConsequenceException: rule: ruleA
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:915)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:844)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1055)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:733)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:699)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at
com.example.KnowledgeSessionGatewayImpl.insertEventA(KnowledgeSessionGatewayImpl.java:48)
at com.example.KnowledgeSessionGatewayImpl.receive(KnowledgeSessionGatewayImpl.java:74)
at com.example.events.EventFeeder$FeedJob.execute(EventFeeder.java:58)
at
org.drools.time.impl.PseudoClockScheduler$ScheduledJob.call(PseudoClockScheduler.java:227)
at
org.drools.time.impl.PseudoClockScheduler.runCallBacks(PseudoClockScheduler.java:176)
at org.drools.time.impl.PseudoClockScheduler.advanceTime(PseudoClockScheduler.java:127)
at com.example.RulesTestBase.advanceTime(RulesTestBase.java:140)
at com.example.RulesTestBase.advanceTime(RulesTestBase.java:152)
at com.example.Rules2Test.testScenarioA(Rules2Test.java:280)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:66)
at org.jmock.integration.junit4.JMock$1.invoke(JMock.java:37)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:94)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
at
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:98)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: [Error: unable to resolve method:
$Proxy10.methodWith3Parameters(com.example.Record, java.lang.Long, ) [arglength=3]]
[Near : {... System.out.println("Rule {" + ....}]
^
[Line: 1, Column: 1]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1042)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:339)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:141)
at
org.mvel2.optimizers.dynamic.DynamicOptimizer.optimizeAccessor(DynamicOptimizer.java:67)
at org.mvel2.ast.ASTNode.optimize(ASTNode.java:161)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:117)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:87)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:125)
at org.mvel2.MVEL.executeExpression(MVEL.java:960)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:105)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:905)
... 37 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see: