[jboss-jira] [JBoss JIRA] (DROOLS-1308) Rules compilation failure depending on condition ordering

Mario Fusco (JIRA) issues at jboss.org
Tue Sep 27 12:51:00 EDT 2016


    [ https://issues.jboss.org/browse/DROOLS-1308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13299290#comment-13299290 ] 

Mario Fusco commented on DROOLS-1308:
-------------------------------------

I reproduced this problem with this simple rule

{code}
rule R when
  $l : List( )
  String() from $l
  (String() or Number())
then end
{code}

The problem there is that the parser reads the from expression as 

{code}
from $l (String() or Number())
{code}

and it is impossible to disambiguate this from a function call. The straightforward fix to this is wrapping also the from clause in parenthesis as it follows:

{code}
rule R when
  $l : List( )
  (String() from $l)
  (String() or Number())
then end
{code}

We will fix the DRL marshaller accordingly.

> Rules compilation failure depending on condition ordering
> ---------------------------------------------------------
>
>                 Key: DROOLS-1308
>                 URL: https://issues.jboss.org/browse/DROOLS-1308
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 6.4.0.Final
>            Reporter: Martin Weiler
>            Assignee: Mario Fusco
>
> When creating rules in guided editor, we are running into validation errors depending on the order of the conditions. The problem is that the order of the conditions is important:
> {noformat}
> when
>   COND_X
>   COND_Y   => works
> when
>   COND_Y
>   COND_X   => fails
> java.lang.AssertionError: [10,18]: [ERR 101] Line 10:18 no viable alternative at input 'Number' in rule "ATO_Negative_AU_Test"
> [0,0]: Parser returned a null Package
> {noformat}
> Test cases showing the compilation failures (@Test testOrder1 vs
> testOrder2) can be found here:
> https://gist.github.com/martinweiler/e684a0e75a2c9f4de4dee5a13affb8b0



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list