[
http://jira.jboss.com/jira/browse/JBRULES-1262?page=comments#action_12399007 ]
M H commented on JBRULES-1262:
------------------------------
For me the problem seems to be the following:
i'm in class DefaultExpander.java
private static final Pattern patternFinder = Pattern.compile( "\\((.*?)\\)" );
after the first two expand steps we have
$p:Item(eval(title.isEqual("test"))
which is correct. During the third step the patternfinder gets
'eval(title.isEqual("test"' and copies into variable constraint, and
appends eval(id.isEqual("test") separeted with "," which is wrong.
When eval is used, the patternFinder does not what is necessary.
I'll tired the following:
private static final Pattern patternFinderEval = Pattern.compile(
"\\(.*(eval\\(.*\\)).*\\)" );
Line 250:
if (expanded[lastPattern].trim().indexOf("eval") > -1)
{
m2 = patternFinderEval.matcher( expanded[lastPattern] );
}
else
{
m2 = patternFinder.matcher( expanded[lastPattern] );
}
it seems to work, but someone else has to check this ...
DSL Parser "eval"
-----------------
Key: JBRULES-1262
URL:
http://jira.jboss.com/jira/browse/JBRULES-1262
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Drl Parser/Builder
Affects Versions: 4.0.1
Reporter: M H
Assigned To: Edson Tirelli
Priority: Blocker
Fix For: 4.0.5
[when]of type Item=Item()
[when]- Title equals "{value}"=eval(title.isEqual("{value}")
[when]- Event equals "{value}"=eval(id.isEqual("{value}")
[then]Log : "{message}"=System.out.println("{message}");
the dslr File:
expander Test.dsl
rule "Your First Rule"
when
$p : of type Item
- Title equals "test"
- Event equals "test"
then
#actions
end
resolves to (could be seen in the drl viewer)
rule "Your First Rule"
when
$p :Item( eval(title.isEqual("test",
eval(id.isEqual("test") ) )
then
#actions
end
--
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