Bug 769587
Summary: | drools modify command mvel exception | ||||||
---|---|---|---|---|---|---|---|
Product: | [JBoss] JBoss Enterprise BRMS Platform 5 | Reporter: | Radovan Synek <rsynek> | ||||
Component: | BRE (Expert, Fusion) | Assignee: | Mario Fusco <mfusco> | ||||
Status: | VERIFIED --- | QA Contact: | |||||
Severity: | medium | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | BRMS 5.3.0.GA | CC: | mproctor, rzhang | ||||
Target Milestone: | ER7 | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: |
When trying to execute the MVEL modify command on a stateful session an exception occurs (unable to resolve method). This was caused by a omission in the following line: sbuilder.append( setter.getAccessor() + " = " + setter.getValue() + "\n" ); which should have been: sbuilder.append( setter.getAccessor() + " = '" + setter.getValue() + "'\n" );. The error has been corrected and the issue no longer occurs.
|
Story Points: | --- | ||||
Clone Of: | Environment: | ||||||
Last Closed: | Type: | --- | |||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Mario Fusco <mario.fusco> updated the status of jira JBRULES-3377 to Resolved Please verify the issue on 5.3 ER4. Problem still occurs, the same exception. Pull request with reproducer: https://github.com/droolsjbpm/drools/pull/104 The fix has been backported to the 5.3.x by upgrading the mvel version in use. Comment 7 suggests that this has been fixed a while ago. Moving to ON_QA. Looks like this issue is resolved on master (mvel2-2.1.0.drools10.jar), but not on 5.3.x (mvel2-2.1.0.drools8.jar) I upgraded the mvel version used also by the 5.3.x, so this issue should be fixed also there. Update status to ON_QA. Please verify them against ER6. I have tried on ER6 and there is the same exception. I am not so sure that problem is with MVEL version; the test case provided in pull request (see comment 6) works on master but fails on 5.3.x for me - although both branches use the same MVEL version. Also I have found a difference between these two branches in method org.drools.command.runtime.rule.ModifyCommand.getMvelExpr() - which is on the exception stack trace. master line 115: sbuilder.append( setter.getAccessor() + " = '" + setter.getValue() + "'\n" ); 5.3.x: line 115: sbuilder.append( setter.getAccessor() + " = " + setter.getValue() + "\n" ); The difference is missing "'" sign on 5.3.x. Isn't it possible that this is the problem? Mario Fusco <mario.fusco> made a comment on jira JBRULES-3377 Indeed I flagged 5.4.0.CR1 as the fix version for this issue, not the 5.3 I just backported the fix to the 5.3 This fix has been committed to project branch which BRMS 5.3 used. So this requires to request block+ flag or revert in the branch at current phase. The fixed for this issue should be included in ER7. Please do verification on it. 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: When trying to execute the MVEL modify command on a stateful session an exception occurs (unable to resolve method). This was caused by a omission in the following line: sbuilder.append( setter.getAccessor() + " = " + setter.getValue() + "\n" ); which should have been: sbuilder.append( setter.getAccessor() + " = '" + setter.getValue() + "'\n" );. The error has been corrected and the issue no longer occurs. |
Created attachment 549016 [details] modify command reproducer - maven project Following exception occurs when trying to execute modify command on stateful session: { with (this) { age = 30 ,name = Frank ,id = 0 ,likes = nobody } } Exception in thread "main" [Error: unable to resolve method: com.redhat.modifyreproducer.Person.Frank() [arglength=0]] [Near : {... ,name = Frank ....}] ^ [Line: 5, Column: 1] at org.mvel2.PropertyAccessor.getMethod(PropertyAccessor.java:977) at org.mvel2.PropertyAccessor.getBeanProperty(PropertyAccessor.java:687) at org.mvel2.PropertyAccessor.getNormal(PropertyAccessor.java:202) at org.mvel2.PropertyAccessor.get(PropertyAccessor.java:171) at org.mvel2.PropertyAccessor.get(PropertyAccessor.java:151) at org.mvel2.ast.ASTNode.getReducedValue(ASTNode.java:185) at org.mvel2.MVELInterpretedRuntime.parseAndExecuteInterpreted(MVELInterpretedRuntime.java:106) at org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:49) at org.mvel2.MVEL.eval(MVEL.java:408) at org.mvel2.util.ParseTools.parseWithExpressions(ParseTools.java:1591) at org.mvel2.ast.WithNode.getReducedValue(WithNode.java:75) at org.mvel2.MVELInterpretedRuntime.parseAndExecuteInterpreted(MVELInterpretedRuntime.java:106) at org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:49) at org.mvel2.MVEL.eval(MVEL.java:109) at org.drools.command.runtime.rule.ModifyCommand.execute(ModifyCommand.java:79) at org.drools.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:798) at org.drools.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:781) at com.redhat.modifyreproducer.Main.test(Main.java:52) at com.redhat.modifyreproducer.Main.main(Main.java:30) ------------------------------------------------------------------------------ First, fact is inserted into the session, next step is creating Modify command with setter list: Person p1 = new Person("John", "nobody", 25); session.execute(CommandFactory.newInsert(p1)); FactHandle fh = session.getFactHandle(p1); Person p = new Person("Frank", "nobody", 30); List<Setter> setterList = new ArrayList<Setter>(); setterList.add(CommandFactory.newSetter("age", String.valueOf(p.getAge()))); setterList.add(CommandFactory.newSetter("name", p.getName())); setterList.add(CommandFactory.newSetter("likes", p.getLikes())); setterList.add(CommandFactory.newSetter("id", String.valueOf(p.getId()))); session.execute(CommandFactory.newModify(fh, setterList)); See an attachment for the details, just build as maven project and run.