Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2518

equal sign (=) in string literal in MVEL modify statement causes error

    XMLWordPrintable

Details

    Description

      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

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            steveminer_jira Steve Miner (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: