Bug 1039558 - GRE: inserted fact using already defined variable
Summary: GRE: inserted fact using already defined variable
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: Business Central
Version: unspecified
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ER6
: 6.0.0
Assignee: manstis
QA Contact: Jiri Locker
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-09 13:01 UTC by Jiri Locker
Modified: 2014-08-06 20:16 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-08-06 20:16:42 UTC
Type: Bug


Attachments (Terms of Use)
step1: insert fact #1 (10.75 KB, image/png)
2013-12-09 13:02 UTC, Jiri Locker
no flags Details
step2: reopen the rule (11.14 KB, image/png)
2013-12-09 13:02 UTC, Jiri Locker
no flags Details
step3: insert fact #2 (14.45 KB, image/png)
2013-12-09 13:03 UTC, Jiri Locker
no flags Details
step4: validate (25.30 KB, image/png)
2013-12-09 13:03 UTC, Jiri Locker
no flags Details

Description Jiri Locker 2013-12-09 13:01:05 UTC
Description of problem:
New facts are assigned to variables before inserting into WM so that they can be initialized via setter methods. Variable names are generated by GRE and can be later changed by user. GRE generates names like fact0, fact1, etc.

The problem occurs after opening an existing rule that contains inserted fact assigned to fact0 variable. GRE doesn't recognize that fact0 is already used and starts generating variable names from fact0 again. When user adds another fact, it is assigned to fact0 and so fact0 is declared twice. This seems to be valid as long as the two facts are of the same type. However, if the *types are different*, the declaration is erroneous. Even so, nothing appears to be wrong until user validates the rule or project build is triggered. This can be easily fixed by assigning the new inserted fact to a different variable, but the validation (or build) error is very unexpected and confusing.

Version-Release number of selected component (if applicable):
ER5

How reproducible:
-

Steps to Reproduce:
1. create new rule
2. insert Fact1 and set value of one of its fields
3. save the rule and close it
4. reopen the rule
5. insert Fact2 and set value of one of its fields (notice that Fact1 and Fact2 are different types)
6. check rule source and validate it

Actual results:
Variable fact0 declared twice with different types. This is generated by GRE, user may save the rule without noticing if validation is skipped.

Expected results:
GRE should keep the rule valid when generating DRL source. It should detect that variable fact0 is already declared and choose next available name.

Additional info:

Comment 1 Jiri Locker 2013-12-09 13:02:12 UTC
Created attachment 834314 [details]
step1: insert fact #1

Comment 2 Jiri Locker 2013-12-09 13:02:53 UTC
Created attachment 834315 [details]
step2: reopen the rule

Comment 3 Jiri Locker 2013-12-09 13:03:31 UTC
Created attachment 834316 [details]
step3: insert fact #2

Comment 4 Jiri Locker 2013-12-09 13:03:56 UTC
Created attachment 834317 [details]
step4: validate

Comment 6 Jiri Locker 2014-01-02 09:48:08 UTC
Verified on ER6.


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