Bug 1268643 - Guided Rule editor is unable to Validate a rule with complex Date comparison scenario
Guided Rule editor is unable to Validate a rule with complex Date comparison ...
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: Business Central (Show other bugs)
All All
high Severity high
: ER5
: 6.2.0
Assigned To: manstis
Jiri Locker
Depends On:
  Show dependency treegraph
Reported: 2015-10-04 02:47 EDT by Musharraf Hussain
Modified: 2015-11-09 07:25 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-11-05 12:26:11 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
bare_niogit.zip (317.79 KB, application/zip)
2015-10-04 02:50 EDT, Musharraf Hussain
no flags Details

  None (edit)
Description Musharraf Hussain 2015-10-04 02:47:41 EDT
Description of problem:
- Guided Rule editor is not able to validate successfully a rule "TestRule" which has complex java.util.Date type validation like the following.
There is an Employee [$emp] with:	
    any of the following:  	
        all of the following:	
            joiningDate greater than or equal to 01-Aug-2015
            joiningDate less than or equal to 02-Oct-2015	

        all of the following:	
            joiningDate greater than or equal to 01-May-2015
            joiningDate less than or equal to 02-Oct-2015   


While validating the above rule in BRMS 6.1.3 it throws the following exception.
Unable to Analyse Expression joiningDate >= "01-Aug-2015" && joiningDate <= "02-Oct-2015" || joiningDate >= "01-May-2015" && joiningDate <= "02-Oct-2015":
[Error: Comparison operation requires compatible types. Found class java.util.Date and class java.lang.String]
[Near : {... || joiningDate >= "01-May-2015" && joiningDate <= "02-Oct-2015" ....}]
[Line: 8, Column: 2] : [Rule name='TestRule']

- Interestingly, if I create a DRL "TestDRL.drl" in the same project and write a similar constraint like the following it also causes the same issue during validation.
package org.kie.example.project1;

rule "TestDRL"
dialect "mvel"
	        $employee : Employee( ( joiningDate >= "01-Aug-2015" && joiningDate <= "02-Oct-2015" )|| ( joiningDate >= "01-May-2015" && joiningDate <= "02-Oct-2015" ))

However, if I rename the rule from "TestDRL" to "TestRule" which is the name of the Guided Rule above it does not throw any error while validating the rule.

- Just to add, this Bugzilla [1] was raised earlier to fix an issue with multiple java.util.Date type validation, causing the browser to hang for Guided Rule editor.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1251017

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

How reproducible:
- Always

Steps to Reproduce:
1. Import the attached bare git repository "bare_niogit.zip" inside your BRMS 6.1.3 installation.
2. Try to validate the "TestRule" Guided Rule in "project1" from Business Central.
3. Try to validate the "TestDRL" DRL in "project1" from Business Central.
4. Try renaming the rule name in "TestDRL" DRL from "TestDRL" to "TestRule" to successfully validate the DRL.

Actual results:
- Steps (2) and (3) would throw the exceptions quoted earlier. Step (4) should validate the rule successfully.

Expected results:
- Rules should be validated correctly.

Additional info:
- Nothing
Comment 2 Musharraf Hussain 2015-10-04 02:50 EDT
Created attachment 1079703 [details]
Comment 4 manstis 2015-10-05 04:38:17 EDT
Unable to replicate either issue (Guided Rule or DRL) with 6.3.x (Community), 6.2.x (Product). Set to MODIFIED to allow QE to verify too.
Comment 5 Jiri Locker 2015-11-05 12:26:11 EST
6.2.0 is not affected by this. However I reproduced with the latest 6.1.x patch (6.1.4). CC Alessandro - you may want to clone this to a (6.1.z) bugzilla.

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