[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2518) equal sign (=) in string literal in MVEL modify statement causes error

Steve Miner (JIRA) jira-events at lists.jboss.org
Mon May 24 14:03:55 EDT 2010


    [ https://jira.jboss.org/browse/JBRULES-2518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12532128#action_12532128 ] 

Steve Miner commented on JBRULES-2518:
--------------------------------------

Comma (,) causes a similar problem.  Try modifying a field to a literal with a single comma in it.

modify ($d) {name = "foo, bar"};    // fails

modify ($d) {name = "foo x bar"};   // works

> equal sign (=) in string literal in MVEL modify statement causes error
> ----------------------------------------------------------------------
>
>                 Key: JBRULES-2518
>                 URL: https://jira.jboss.org/browse/JBRULES-2518
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core  (expert)
>    Affects Versions: 5.0.1.FINAL
>         Environment: Mac OS X 10.6.3, Java 1.6
>            Reporter: Steve Miner
>            Assignee: Mark Proctor
>
> rule "mvel equal sign bug"
> 	dialect "mvel"
> 	when
> 		$d: Dog(name == "Bertie")
> 	then
> 		modify ($d) {name = "Bertie = Boy"};
> end
> Note the string literal for the new value for name contains an equal sign (=).  That causes an error.  Apparently, the modify macro or the MVEL parser is choking on the equal sign.
> java.lang.Error: org.drools.rule.InvalidRulePackage: Unable to build expression for 'consequence': [Error: unterminated literal]
> [Near : {... h ($d) {name = "Bertie = Boy"} ....}]
>                                           ^
> [Line: 1, Column: 43] '		modify ($d) {name = "Bertie = Boy"};
> ' : [Rule name='mvel equal sign bug']
> If I remove the "=" from inside the string literal (substituting "is a"), it works as expected.
> rule "mvel equal sign bug"
> 	dialect "mvel"
> 	when
> 		$d: Dog(name == "Bertie")
> 	then
> 		modify ($d) {name = "Bertie is a Boy"};
> end

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list