]
Toni Rikkola updated JBRULES-2814:
----------------------------------
Fix Version/s: 5.5.0.Beta1
(was: 5.4.0.Final)
DSL variable definition may create strange effects
--------------------------------------------------
Key: JBRULES-2814
URL:
https://issues.jboss.org/browse/JBRULES-2814
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-compiler-DSL
Affects Versions: 5.1.1.FINAL
Reporter: Wolfgang Laun
Assignee: Edson Tirelli
Fix For: 5.5.0.Beta1
The DSL parser accepts variable definitions
{name}
{name:pattern}
{name:q:pattern}
but also
{name:xyz:}
a) What *is* the purpose of "q"? It is tested in DSLMapWalker and influences
what is used as a pattern, sometimes overriding a specified pattern: q pattern
use-for-matching null null (.*?) null pattern pattern X null (.*?) X pattern pattern ENUM
-- (.*?) DATE -- (.*?) BOOLEAN -- (.*?)
b) A "null" pattern is used for matching if {name:xyz:} is used.
I think the "q" is a relic and should be discarded. A ':' as delimiter
in an area where any character is possible (as in a pattern) is bound to create
ambiguities.
The "C" entry in the DSL below produces "null" in the pattern trying
to match a condition; i.e., the string "null" is actually matched.
A, E, F result in pattern "(.*?)"
B, D use the pattern ("Boolean" or "Double", respectively)
DSL:
[when][]A {type} value=${type}: {type}()
[when][]B {type:Boolean} value=${type}: {type}()
[when][]C {type:xyz:} value=${type}: {type}()
[when][]D {type:xyz:Double} value=${type}: {type}()
[when][]E {type:ENUM:} value=${type}: {type}()
[when][]F {type:DATE:Float} value=${type}: {type}()
DSLR:
rule "rule 1"
when
A Integer value
B Boolean value
C Character value # fails; use "null" instead of Character to get a match
D Double value
E Enum value
F Float value
then
> System.out.println( "hello" );
end
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: