[
http://jira.jboss.com/jira/browse/JBRULES-394?page=all ]
Mark Proctor closed JBRULES-394.
--------------------------------
Fix Version/s: 3.1-m1
Resolution: Cannot Reproduce Bug
I have added this test to trunk - see IntegratCases.testDuplicateRuleNames() - but it does
not produce any errors. Please check trunk to see if we are missing anything that produces
your error.
NPE trying to add the same drl to a rulebase twice
--------------------------------------------------
Key: JBRULES-394
URL:
http://jira.jboss.com/jira/browse/JBRULES-394
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 3.0.3
Reporter: k s
Assigned To: Mark Proctor
Priority: Minor
Fix For: 3.1-m1
While doing some experimenting, I generated two almost identical DRLs out of almost
identical decision tables. The only difference is in the ruleset/package name The DRLs are
provided below. Then I tried to add the two DRLs as packages in the same rulebase. That
was not really intentional, but that's another story!. Anyway, the attempt to add the
second package resulted in a NPE at point where rule names are checked for equality. After
playing around a bit, it seems that the root of the problem is that the rules in the two
packages have the same names.
----------------------------------------------------------
Here's the relevant stack trace:
----------------------------------------------------------
java.lang.NullPointerException
at org.drools.rule.Rule.equals(Rule.java:435)
at org.drools.reteoo.TerminalNode.equals(TerminalNode.java:320)
at java.util.ArrayList.indexOf(ArrayList.java:220)
at java.util.ArrayList.contains(ArrayList.java:201)
at org.drools.reteoo.TupleSource.addTupleSink(TupleSource.java:79)
at org.drools.reteoo.TerminalNode.attach(TerminalNode.java:250)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:195)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:240)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:255)
----------------------------------------------------------
Here are the first DRL:
----------------------------------------------------------
package Some_business_rules;
#generated from Decision Table
import org.drools.decisiontable.Cheese;
import org.drools.decisiontable.Person;
global java.util.List list;
#From row number: 17
rule "Cheese fans_17"
salience 65519
when
Person(age == 42)
Cheese(type=="stilton")
then
list.add("Old man stilton");
end
#From row number: 18
rule "Cheese fans_18"
salience 65518
when
Person(age == 21)
Cheese(type=="cheddar")
then
list.add("Young man cheddar");
end
----------------------------------------------------------
Here are the second DRL:
----------------------------------------------------------
Some_other_business_rules;
#generated from Decision Table
import org.drools.decisiontable.Cheese;
import org.drools.decisiontable.Person;
global java.util.List list;
#From row number: 17
rule "Cheese fans_17"
salience 65519
when
Person(age == 42)
Cheese(type=="stilton")
then
list.add("Old man stilton");
end
#From row number: 18
rule "Cheese fans_18"
salience 65518
when
Person(age == 21)
Cheese(type=="cheddar")
then
list.add("Young man cheddar");
end
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira