[jboss-jira] [JBoss JIRA] (DROOLS-39) A NPE occurs silently when execute a complex rule a lot of time
Jérémy SOULA (JIRA)
jira-events at lists.jboss.org
Wed Feb 13 08:23:56 EST 2013
[ https://issues.jboss.org/browse/DROOLS-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jérémy SOULA updated DROOLS-39:
-------------------------------
Attachment: drools-bugs.zip
Join a test project for this bug
> A NPE occurs silently when execute a complex rule a lot of time
> ---------------------------------------------------------------
>
> Key: DROOLS-39
> URL: https://issues.jboss.org/browse/DROOLS-39
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 5.5
> Environment: Windows XP, java 1.5
> Reporter: Jérémy SOULA
> Assignee: Mark Proctor
> Attachments: drools-bugs.zip
>
>
> Found this bug when I update from drools v5.3
> Here are the rule that simulate this bug :
> {noformat}
> rule "toto"
> when
> $bean:Bean (
> anotherBean!=null,
> (
> anotherBean.anotherBean !=null
> &&
> (
> (
> anotherBean.anotherBean.attribute=="TOTO"
> &&
> anotherBean.attribute=="TOTO"
> )
> ||
> (
> anotherBean.anotherBean.attribute=="TATA"
> &&
> anotherBean.attribute=="TATA"
> )
> )
> )
> ||
> (
> anotherBean.attribute=="TOTO"
> )
> )
> then
> ...
> end
> {noformat}
> A part of main:
> {noformat}
> for (int i = 0; i < 400; i++) {
> Bean input1 = new Bean();
> input1.setAttribute("" + i);
> input1.setAnotherBean(new Bean());
> kbase.newStatelessKnowledgeSession().execute(Arrays.asList(input1));
> }
> {noformat}
> At one time, the log print this exception. Units tests of my application are 100%, but this exception in the log is quite disturbing
> {noformat}java.lang.RuntimeException: cannot invoke getter: getAnotherBean [declr.class: fr.jsoula.jboss.drools.bugs.npe.Bean; act.class: fr.jsoula.jboss.drools.bugs.npe.Bean] (see trace)
> at org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:74)
> at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
> at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:108)
> at org.mvel2.ast.And.getReducedValueAccelerated(And.java:34)
> at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
> at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
> at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
> at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:113)
> at org.mvel2.MVEL.executeExpression(MVEL.java:930)
> at org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:70)
> at org.drools.rule.constraint.MvelConditionEvaluator.ensureBranchEvaluation(MvelConditionEvaluator.java:117)
> at org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:101)
> at org.drools.rule.constraint.MvelConditionEvaluator.ensureBranchEvaluation(MvelConditionEvaluator.java:120)
> at org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:102)
> at org.drools.rule.constraint.MvelConditionEvaluator.ensureBranchEvaluation(MvelConditionEvaluator.java:120)
> at org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:101)
> at org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:90)
> at org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:82)
> at org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:270)
> at org.drools.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:51)
> at org.drools.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:250)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
> at java.lang.Thread.run(Thread.java:595)
> 31
> Caused by: java.lang.RuntimeException: cannot invoke getter: getAnotherBean [declr.class: fr.jsoula.jboss.drools.bugs.npe.Bean; act.class: fr.jsoula.jboss.drools.bugs.npe.Bean] (see trace)
> at org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:74)
> at org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:40)
> ... 23 more
> Caused by: java.lang.RuntimeException: unable to invoke method: fr.jsoula.jboss.drools.bugs.npe.Bean.getAttribute: target of method is null
> at org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:66)
> at org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:40)
> ... 24 more
> Caused by: java.lang.NullPointerException
> at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:592)
> at org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:43)
> ... 25 more
> {noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list