Created attachment 849413 [details] guided rule before reopening Description of problem: If you leave a constraint element on a String field incomplete, save and reopen, the definition for this element will change and all conditions elements that were below it will disappear. Version-Release number of selected component (if applicable): BPMS 6.0 ER7 Steps to Reproduce: With data model including StringFact POJO with attribute field of type String: 1. Open or create a new guided rule. 2. Add some valid condition elements: There is a Fact1 with: field1 equal to 1 There is a Fact2 with: field2 equal to "some text" 3. Add StringFact, click it to add a constraint on field. 4. Select an operator (e.g. equal to). 5. Add a few more valid condition elements, similar to step 2. 6. Save, close and reopen the rule. Actual results: Condition elements from step 2 are present, elements from step 4 are not. Condition added in step 3 has changed to "Any of the following are true: There is a StringFact". Expected results: Condition elements both from step 2 and step 4 are present. Element from step 3 does not contain the incomplete constraint, but is otherwise unchanged (the same behaviour as with other types). Additional info: The issue seems to be with String fields only, e.g. Integer fields were ok. If you don't select an operator, the (unfinished) constraint won't get into the rule source and rule reopens as it should (only the incomplete constraint is missing, as per bug 1023126 comment 5).
Created attachment 849418 [details] guided rule after reopening What these screenshots don't show is that (contrary to what was reported in bug 1023126), the RHS stays the same after reopening. Also, the source tab shows "StringFact( field == )" for the incomplete condition/constraint (before reopening).
I am not sure this can be fixed on the back end. Finding an unmatched quote our double-quote will make the lexer go nuts. Is there a way to force the UI to not allow unmatched quotes?
We can add validation for this in the UI.
master: https://github.com/droolsjbpm/drools-wb/commit/c0c8dc08ec1ced5eaecb5b808c90e36d297047f4 https://github.com/droolsjbpm/drools-wb/commit/e4e85865e31da3fcd421c7ad1d86875d1132ce9f https://github.com/droolsjbpm/drools-wb/commit/3fe2e0335
Last one for master: https://github.com/droolsjbpm/drools-wb/commit/03578eb6e 6.0.x: https://github.com/droolsjbpm/drools-wb/commit/7b10d1d57f6982796ae4d2fc4db6af92c132604d https://github.com/droolsjbpm/drools-wb/commit/35570af0fd73d385633e1ee3da675af02563b57c https://github.com/droolsjbpm/drools-wb/commit/eae3bb5c6d1c16c78b09e3bde359389e609b6ae7 https://github.com/droolsjbpm/drools-wb/commit/2cf377c1526f3ce7e568329ec0547b58d38a5dab
The rule will still fail to open, but the validation should prevent the user from saving rules that do not open.
Verified with ER2 - it is no longer possible to save such a rule.