Bug 1076158
| Summary: | Guided Rule Editor allows to save invalid rules and then fails to open them. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Retired] JBoss BRMS Platform 6 | Reporter: | Marek Baluch <mbaluch> | ||||||
| Component: | Business Central | Assignee: | Toni Rikkola <trikkola> | ||||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Marek Baluch <mbaluch> | ||||||
| Severity: | high | Docs Contact: | |||||||
| Priority: | high | ||||||||
| Version: | 6.0.1 | CC: | kverlaen, lpetrovi, mbaluch | ||||||
| Target Milestone: | ER1 | ||||||||
| Target Release: | 6.0.2 | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2014-08-06 19:54:40 UTC | Type: | Bug | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Attachments: |
|
||||||||
Created attachment 874074 [details]
rule screenshot
Created attachment 874075 [details]
error message screenshot
Not sure how the "from f1.field1.size() == 0" was made. Could I get more detailed steps for that part, please? Is easy to produce invalid rule with String.size(). 1. Add Applicant 2. Add Expression builder 3. Choose name 4. Choose isEmpty This will result in Applicant( name.size() == 0). Seems OK, but rule validation will fail. To get something like "from f1.field1.size() == 0": 1. Add Applicant 2. Set bound variable name to 'a' 3. Add 'From' conditional element 4. In the Expression builder following 'From' build a.name.isEmpty() I agree with Marek's point that once an invalid rule is saved and closed it is impossible to open and fix it in the UI. In another issue regarding Guided editor we took the approach to drop invalid parts of the rule during save. Would it be suitable for this situation? Jirka - thank you for providing the requested information. Thanks for the help. Managed to reproduce both cases. One problem was that String does not have size() it has length(). Another problem was that when we added size (length now) or isEmpty we used .length() and .isEmpty() in the drl. The strick mode that the workbench uses wants .length and .empty. Third issue was, that when isEmpty was selected the editor actually changed that to "length() == 0". That is what isEmpty() does internally, but it does break from for example. Now we just use the isEmpty() method directly. https://github.com/droolsjbpm/drools-wb/commit/58523e185 https://github.com/droolsjbpm/drools-wb/commit/fbe0111af Verified on 6.0.2.ER2. |
Description of problem: When using the guided rule editor it is possible to create and save an invalid rule which then cannot be opened anymore. The root cause is that the editor allows to create expressions from methods which are not present on an object. E.g. the error bellow was obtained by using a custom object Fact1.String.size() method. 17:24:13,050 ERROR [org.drools.compiler.kie.builder.impl.AbstractKieModule] (pool-11-thread-2) Unable to build KieBaseModel:kbase1 Unable to Analyse Expression f1.field1.size() == 0: [Error: unable to resolve method using strict-mode: java.lang.String.size()] [Near : {... f1.field1.size() == 0 ....}] ^ : [Rule name='variableRule'] Version-Release number of selected component (if applicable): BRMS 6.0.1.ER2 Steps to Reproduce: 1. Create a class Field1 containing a variable field1 of type String. 3. Create a new rule: 1. | package guvnor.bugs.boundvar; 2. | 3. | import java.lang.Number; 4. | 5. | rule "variableRule" 6. | dialect "mvel" 7. | when 8. | f1 : Fact1( ) 9. | f2 : Fact1( field1 == "XYZ" ) 10. | from f1.field1.size() == 0 11. | then 12. | f1.setField1( "ZYX" ); 13. | update( f1 ); 14. | end 4. Save and attempt to reopen. Actual results: Reopen will fail with message: Unable to complete your request. The following exception occurred: null. Only the ERROR message above will be present in the server log. No exception stack. Expected result: No error message and the rule will open Additional info: See attached image.