[jboss-jira] [JBoss JIRA] Created: (JBRULES-1012) Dot is removed while substituting variables with values in DSL

Oleg Iavorskyi (JIRA) jira-events at lists.jboss.org
Tue Jul 17 10:37:47 EDT 2007


Dot is removed while substituting variables with values in DSL
--------------------------------------------------------------

                 Key: JBRULES-1012
                 URL: http://jira.jboss.com/jira/browse/JBRULES-1012
             Project: JBoss Rules
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Drl Parser/Builder
    Affects Versions:  4.0.0.MR3
         Environment: Windows XP, JDK 1.5.0_12
            Reporter: Oleg Iavorskyi
         Assigned To: Mark Proctor


There is DSL file with next content:

[when] There is a {type} named {name} = {name} : {type}() 
[when] - {prop} is {val} = {prop} == {val}

And DRL which uses this DSL:

package prototype

import com.test.types.ClientServiceTypeType;
import com.test.ClientService;

expander ValidationCasesPrototype.dsl

rule "Bug with dot reduction"
	when
		There is a ClientService named cs
		- type is ClientServiceTypeType.GOLD
	then 
		# Then part
end

ClientServiceTypeType.GOLD is a public static final ClientServiceTypeType field.

When building package from this DRL file I've got next exception:

java.lang.RuntimeException: org.drools.rule.InvalidRulePackage: Unable to return Declaration for identifier 'ClientServiceTypeTypeGOLD' : [Rule name=Bug with dot reduction, agendaGroup=MAIN, salience=0, no-loop=false]

	at com.prototype.parser.BaseRuleLoader.readRule(BaseRuleLoader.java:54)
	at com.prototype.parser.BaseRuleLoader.<init>(BaseRuleLoader.java:17)
	at com.prototype.HierarchyProcessor.<init>(HierarchyProcessor.java:11)
	at com.prototype.parser.ValidationCasesRunnerTest.setUp(ValidationCasesRunnerTest.java:18)
	at junit.framework.TestCase.runBare(TestCase.java:125)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.drools.rule.InvalidRulePackage: Unable to return Declaration for identifier 'ClientServiceTypeTypeGOLD' : [Rule name=Bug with dot reduction, agendaGroup=MAIN, salience=0, no-loop=false]

	at org.drools.rule.Package.checkValidity(Package.java:409)
	at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:262)
	at com.prototype.parser.BaseRuleLoader.readRule(BaseRuleLoader.java:51)
	... 16 more

It seems that substitution for variables in DSL works incorrectly and simply ignores ".". Quick workaround is to use "\" before dot. In that case rules are loaded correctly.

Same code worked in version 3.0.6.

-- 
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