]
Mark Proctor updated JBRULES-593:
---------------------------------
Fix Version/s: 4.0.0.MR4
please verify/fix and close.
Rule names must be globally unique, even if they come from different
packages
-----------------------------------------------------------------------------
Key: JBRULES-593
URL:
http://jira.jboss.com/jira/browse/JBRULES-593
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Drl Parser/Builder
Affects Versions: 3.0.5
Environment: NA
Reporter: Jeff Lansing
Assigned To: Edson Tirelli
Fix For: 4.0.0.MR4
When 2 DRL rule files with different package names (the name following the
'package' keyword) each have a rule with the same name (the name being the quoted
string that follows the 'rule' keyword), then the following exception occurs:
org.drools.rule.InvalidRulePackage: Rule Compilation error The type
Rule_Incident__Vehicle_0 is already defined
at org.drools.rule.Package.checkValidity(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
at driver.RulesTest.readRule(RulesTest.java:256)
This occurs when using a single org.drools.rule.Package object, as in:
private void test(Reader source1, Reader source2) throws Exception {
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( source1 );
builder.addPackageFromDrl( source2 );
Package pkg = builder.getPackage();
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
}
If, on the other hand two org.drools.rule.Package objects are used, as in:
private void test2(Reader source1, Reader source2) throws Exception {
PackageBuilder builder1 = new PackageBuilder();
PackageBuilder builder2 = new PackageBuilder();
builder1.addPackageFromDrl( source1 );
builder2.addPackageFromDrl( source2 );
Package pkg1 = builder1.getPackage();
Package pkg2 = builder2.getPackage();
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg1 );
ruleBase.addPackage( pkg2 );
}
then one of the identically named rules is simply ignored.
In either case, rule names must be globally unique.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: