Bug 724767 (BRMS-605) - Compilation of rules should fail when is not used quotes in a String attribute
Summary: Compilation of rules should fail when is not used quotes in a String attribute
Keywords:
Status: VERIFIED
Alias: BRMS-605
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion)
Version: 5.1.0 GA
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: ---
: BRMS 5.3.0.GA
Assignee: Mario Fusco
QA Contact: Tomas Schlosser
URL: http://jira.jboss.org/jira/browse/BRM...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-13 19:44 UTC by Alessandro Lazarotti
Modified: 2020-09-10 21:11 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Compilation of rules should fail when quotes are not used for string attributes. This did not happen when numerical values were used as string attributes without quotes, and the rules using numerical values were never matched.
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Issue Tracker BRMS-605 Major Closed Compilation of rules should fail when is not used quotes in a String attribute 2012-09-24 11:38:55 UTC
Red Hat Issue Tracker JBRULES-3080 Major Resolved Compilation of rules should fail when is not used quotes in a String attribute 2012-09-24 11:38:55 UTC

Description Alessandro Lazarotti 2011-06-13 19:44:03 UTC
Help Desk Ticket Reference: https://c.na7.visual.force.com/apex/Case_View?id=500A0000007BKuR&sfdc.override=1
securitylevel_name: Public

Compilation of rules should fail when is not used quotes in a String attribute

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.

Comment 1 Alessandro Lazarotti 2011-06-13 19:46:54 UTC
Link: Added: This issue relates to JBRULES-3080


Comment 2 Rick Wagner 2011-08-25 16:23:31 UTC
Customer ticket for this BZ is still open.  High Priority is justified.

Comment 3 Anne-Louise Tangring 2011-09-14 18:29:54 UTC
Please set the help desk ticket reference in the correct field in BZ using the SalesForce functionality. Thanks!

Comment 4 Alessandro Lazarotti 2011-09-23 14:28:01 UTC
Hi, we don't have a "Target Release" yet.
When is it supposed to be fixed?

Comment 8 Edson Tirelli 2012-03-28 13:55:30 UTC
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.

Comment 10 Alessandro Lazarotti 2012-03-28 14:14:13 UTC
"So,the engine automatically converts 12 into "12"" - yes Edson, it is the point. It does not convert 12 to "12" (maybe it is converting to some char code). So the rule:

 f : Fact( stringAttribute == 12 )

... never is fired if the fact has the property as really "12"

Comment 11 Edson Tirelli 2012-03-28 15:51:54 UTC
Sorry Alessandro, I misunderstood the description of the problem. Indeed I just tested 5.3.x and it is not firing the rule, so it is a bug. Asking Mario to take a look.

Comment 12 JBoss JIRA Server 2012-03-29 18:17:56 UTC
Mario Fusco <mario.fusco@gmail.com> updated the status of jira JBRULES-3080 to Resolved

Comment 13 Mario Fusco 2012-03-29 18:19:41 UTC
I just fixed it on the 5.3.x. It was already fixed (as a side effect of a new feature) on the master.

Comment 14 Ryan Zhang 2012-04-23 07:37:06 UTC
Update status to ON_QA. Please verify them against ER6.

Comment 15 Tomas Schlosser 2012-04-24 10:59:55 UTC
This issue is fixed in ER, thank you.

Comment 16 lcarlon 2012-05-04 02:34:55 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Compilation of rules should fail when quotes are not used for string attributes. This did not happen when numerical values were used as string attributes without quotes, and the rules using numerical values were never matched.


Note You need to log in before you can comment on or make changes to this bug.