Dear developers,
I've stumbled over another nullpointer exception when using the
enabled attribute in conjunction with deleting and adding rules to the
kbase.
For my test I have only one simple rule
rule 'newUser'
enabled(!RuleEngineConf.LOAD)
when
$evt : EventObject(type=='new_user') from entry-point eventstream
then
updateApi.createPlayer($evt.getPlayerid(), true, $evt.getId());
retract($evt);
Not I execute the following sequence
1. setting LOAD=false
2. insert a "new_user" event (works as expected, RHS called)
3. setting LOAD=true
4. insert another "new_user" event (works as expected, RHS NOT called)
5. setting LOAD=false
6. insert another "new_user" event (works as expected, RHS called,
which ends up having two new entities in my entity provider)
7. delete the "newUser" rule; ends up with the following stacktrace
java.lang.NullPointerException
at
org.drools.reteoo.RuleTerminalNode$RTNCleanupAdapter.cleanUp(RuleTerminalNode.java:514)
at org.drools.reteoo.BetaNode.doRemove(BetaNode.java:458)
at org.drools.common.BaseNode.remove(BaseNode.java:109)
at org.drools.reteoo.RuleTerminalNode.doRemove(RuleTerminalNode.java:358)
at org.drools.common.BaseNode.remove(BaseNode.java:109)
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:261)
at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:459)
at org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:1107)
at org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:1085)
at org.drools.impl.KnowledgeBaseImpl.removeRule(KnowledgeBaseImpl.java:208)
8. adding the rule again is followed by stacktrace
java.lang.NullPointerException
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:259)
at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:459)
at org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:1107)
at org.drools.common.AbstractRuleBase.mergePackage(AbstractRuleBase.java:851)
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:610)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:472)
at
org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:150)
However, when I omit step 4., i.e., leaving no orphan event in the WM,
everything works fine, so obviously the ignored event is causing the
exception somehow, i.e., the object retrieved from the activation is
null (the clean up method seems to pickup the activation from the
leftTuple which is null)
Maybe I dont understand it correctly, then I would be happy if someone
explains the proper usage.
Thanks a lot in advance,
Philipp
Show replies by date