Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
None
Description
At the moment the association between a node and a rule is kept by a Map inside the node having the rule as key. This implementation is not taking count of the fact that the same node could be associated multiple times to the same rule that it is indeed what happens when a rule contains a OR.
During the removal of such a rule the nodes of the rule are removed from the Rete starting from the RuleTerminalNodes (in this case the rule has more than one RTNs because of the OR). This means that when the first RTN is removed the Join and LIA nodes that are sources for that RTN at any level got completely disassociated from the rule when it is too early. That in the end causes the following exception when the engine tries to remove also the second RTN of that rule
java.lang.ArrayIndexOutOfBoundsException: 1 at org.drools.core.phreak.AddRemoveRule.removeRule(AddRemoveRule.java:171) at org.drools.core.reteoo.ReteooBuilder.removeTerminalNode(ReteooBuilder.java:173) at org.drools.core.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:163) at org.drools.core.impl.KnowledgeBaseImpl.removeRule(KnowledgeBaseImpl.java:1635) at org.drools.core.impl.KnowledgeBaseImpl.removeRule(KnowledgeBaseImpl.java:1626) at org.drools.core.impl.KnowledgeBaseImpl.internalRemoveRule(KnowledgeBaseImpl.java:1610) at org.drools.core.impl.KnowledgeBaseImpl.removeRule(KnowledgeBaseImpl.java:1581)