[jboss-jira] [JBoss JIRA] (DROOLS-4750) DrlParser fails to parse str[endsWith] operator
Alberto Fanjul Alonso (Jira)
issues at jboss.org
Thu Nov 14 03:30:00 EST 2019
[ https://issues.jboss.org/browse/DROOLS-4750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13812421#comment-13812421 ]
Alberto Fanjul Alonso edited comment on DROOLS-4750 at 11/14/19 3:29 AM:
-------------------------------------------------------------------------
Hi [~mfusco] I didn't describe the case correctly.
Trying to parse a Rule with DrlParser, normally it works,
{code:java}
package com.amadeus.pulse.mainruleset
rule rule1
when
s : String( )
then
insert (s);
end
{code}
but if you add a rule with str operator (str[endsWith] or similar) it fails.
{code:java}
package com.amadeus.pulse.mainruleset
rule rule2
when
s : String( this str[endsWith] "MAN" )
then
insert (s);
end
{code}
After you run a test that builds a KieModule like `_04_buildNoStrWith` DrlParser starts to work with those operators.
I can imagine that KieModule build do some kind of preprocessing of drl rules, and after that DrlParser do not fail.
I suppose is related with launching or enabling `StringConditionInspector` but cannot see how.
So this bug tries to setup the minimal steps to make DrlParser to parse correctly any existing drl rule.
was (Author: afanjula):
Hi [~mfusco] I didn't describe the case correctly.
Trying to parse a Rule with DrlParser, normally it works,
{code:java}
package com.amadeus.pulse.mainruleset
rule rule1
when
s : String( )
then
insert (s);
end
{code}
but if you add a rule with str operator (str[endsWith] or similar) it fails.
{code:drl}
package com.amadeus.pulse.mainruleset
rule rule2
when
s : String( this str[endsWith] "MAN" )
then
insert (s);
end
{code}
After you run a test that builds a KieModule like `_04_buildNoStrWith` DrlParser starts to work with those operators.
I can imagine that KieModule build do some kind of preprocessing of drl rules, and after that DrlParser do not fail.
I suppose is related with launching or enabling `StringConditionInspector` but cannot see how.
So this bug tries to setup the minimal steps to make DrlParser to parse correctly any existing drl rule.
> DrlParser fails to parse str[endsWith] operator
> -----------------------------------------------
>
> Key: DROOLS-4750
> URL: https://issues.jboss.org/browse/DROOLS-4750
> Project: Drools
> Issue Type: Bug
> Reporter: Alberto Fanjul Alonso
> Assignee: Mario Fusco
> Priority: Major
> Attachments: str-with-reproducer.tar
>
>
> In documentation
> https://docs.jboss.org/drools/release/7.23.0.Final/drools-docs/html_single/#drl-rules-WHEN-con_drl-rules
> operator str[endsWith] is supposed to be supported, it it is not working.
> Fails with:
> {code:java}
> java.lang.Exception: Rule contains errors![[5,19]: [ERR 102] Line 5:19 mismatched input 'str' in rule "pnr first name end with"]
> at com.amadeus.mdw.bzr.drools_reproducer.StrWithFailOnFirstCompilationErrorReproducerTest.parse(StrWithFailOnFirstCompilationErrorReproducerTest.java:58)
> at com.amadeus.mdw.bzr.drools_reproducer.StrWithFailOnFirstCompilationErrorReproducerTest._03_parseStrWith(StrWithFailOnFirstCompilationErrorReproducerTest.java:74)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list