NPE in RuleTerminalNode when maintainTMS is false
-------------------------------------------------
Key: JBRULES-2846
URL:
https://issues.jboss.org/browse/JBRULES-2846
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (expert)
Affects Versions: 5.1.1.FINAL
Environment: NA
Reporter: Nathan Bell
Assignee: Mark Proctor
Priority: Minor
copied from my email to rules-dev:
I am pretty sure this is a bug, but would like confirmation from people more familiar with
the code base. My tests seem to show that RuleTerminalNode can cause an NPE on two
different lines of code. Both places where a call is made to
"workingMemory.getTruthMaintenanceSystem()" in that class can result in a null
pointer exception if the "maintainTms" option is false. In my case I discovered
the issue in some unit tests where I am calling
"knowledgeBase.removeKnowledgePackage" which ends up (eventually) in
RuleTerminalNode. I have pasted an example stack trace below:
Thread [main] (Suspended (exception NullPointerException))
RuleTerminalNode$RTNCleanupAdapter.cleanUp(LeftTuple, InternalWorkingMemory) line:
519
ObjectTypeNode.doRemove(RuleRemovalContext, ReteooBuilder, BaseNode,
InternalWorkingMemory[]) line: 347
ObjectTypeNode.remove(RuleRemovalContext, ReteooBuilder, BaseNode,
InternalWorkingMemory[]) line: 325
AlphaNode(ObjectSource).doRemove(RuleRemovalContext, ReteooBuilder, BaseNode,
InternalWorkingMemory[]) line: 209
AlphaNode(BaseNode).remove(RuleRemovalContext, ReteooBuilder, BaseNode,
InternalWorkingMemory[]) line: 109
LeftInputAdapterNode.doRemove(RuleRemovalContext, ReteooBuilder, BaseNode,
InternalWorkingMemory[]) line: 187
LeftInputAdapterNode(BaseNode).remove(RuleRemovalContext, ReteooBuilder, BaseNode,
InternalWorkingMemory[]) line: 109
RuleTerminalNode.doRemove(RuleRemovalContext, ReteooBuilder, BaseNode,
InternalWorkingMemory[]) line: 411
RuleTerminalNode(BaseNode).remove(RuleRemovalContext, ReteooBuilder, BaseNode,
InternalWorkingMemory[]) line: 109
ReteooBuilder.removeRule(Rule) line: 237
ReteooRuleBase.removeRule(Rule) line: 432
ReteooRuleBase(AbstractRuleBase).removeRule(Package, Rule) line: 831
ReteooRuleBase(AbstractRuleBase).removePackage(String) line: 751
KnowledgeBaseImpl.removeKnowledgePackage(String) line: 201
(I redacted the stack after the call to removeKnowledgePackage() because it provides no
value in this discussion)
I am using Drools 5.1.1. I have also looked at the latest version of the code here:
https://github.com/droolsjbpm/droolsjbpm/blob/master/drools-core/src/main...
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira