Details
-
Bug
-
Resolution: Done
-
Major
-
4.0.0.MR3
-
None
Description
There is DSL file with next content:
[when] There is a
{type} named {name} = {name} : {type}()
[when] -
==
{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.