[jboss-jira] [JBoss JIRA] Created: (JBRULES-593) Rule names must be globally unique, even if they come from different packages

Jeff Lansing (JIRA) jira-events at jboss.com
Fri Dec 22 13:41:40 EST 2006


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: Mark Proctor


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: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list