[jboss-jira] [JBoss JIRA] (JBRULES-3080) Compilation of rules should fail when is not used quotes in a String attribute

RH Bugzilla Integration (JIRA) jira-events at lists.jboss.org
Wed Mar 28 09:56:48 EDT 2012


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

RH Bugzilla Integration commented on JBRULES-3080:
--------------------------------------------------

Edson Tirelli <etirelli at redhat.com> made a comment on [bug 724767|https://bugzilla.redhat.com/show_bug.cgi?id=724767]

There is some confusion going on here. When a constraint uses operations between different types of data, the engine will try to coerce them into compatible types. So in the state example: 

f : Fact( stringAttribute == 12 )

The engine identifies the incompatible (but valid) types, and try to coerce the constant 12 (number) into a compatible type to compare to the attribute. So, the engine automatically converts 12 into "12" and then compare to the string attribute. This is the expected behavior.

On the other example though:

f : Fact( stringAttribute == ab )

Unless ab is a previously declared variable, it is not a valid type, so a compilation error is raised and no coercion is attempted. 

This is not a bug.
                
> Compilation of rules should fail when is not used quotes in a String attribute
> ------------------------------------------------------------------------------
>
>                 Key: JBRULES-3080
>                 URL: https://issues.jboss.org/browse/JBRULES-3080
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler
>    Affects Versions: 5.1.1.FINAL
>            Reporter: Alessandro Lazarotti
>            Assignee: Mario Fusco
>
> It is mandatory that Strings are placed between quotes. Guvnor/BRMS or DRL's plain text should fail if you forgot the quotes but currently it just fails the build if you put a value different of numerics:
>  f : Fact( stringAttribute == ab )
> It will fail. The same must occur for:
>  f : Fact( stringAttribute == 12 )
> ... but it does not happen and the rule is never matched. 
> It is very important keep the same behaviour for both cases. The rule's author needs to know about it before the package is built.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list