Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-655

Macro parameter value can't be changed inside a macro

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.6.1
    • Component/s: Engine
    • Labels:
      None

      Description

      I've detected a problem when changing parameter values inside a macro using velocity engine version 1.6.

      In my use case I have to lower the input string first and then do further processing.

      With version 1.5 of the velocity engine there were no problems to implement this use case.

      Here is an example which shows the differences between version 1.5 and 1.6:

      Template-Code:

      #macro(testMacro $x)
      #set ($x = $x.toLowerCase())
      #set ($y = $x.toLowerCase())
      x=$x
      y=$y
      #end
      #testMacro('ABCDEFGHIJKLMNOPQRSTUVWXYZ-Testcase1')
      #testMacro("ABCDEFGHIJKLMNOPQRSTUVWXYZ-Testcase2")
      

      Result with Velocity Engine 1.5:
      x=abcdefghijklmnopqrstuvwxyz-testcase1
      y=abcdefghijklmnopqrstuvwxyz-testcase1
      x=abcdefghijklmnopqrstuvwxyz-testcase2
      y=abcdefghijklmnopqrstuvwxyz-testcase2

      Result with Velocity Engine 1.6:
      x=ABCDEFGHIJKLMNOPQRSTUVWXYZ-Testcase1
      y=abcdefghijklmnopqrstuvwxyz-testcase1
      x=ABCDEFGHIJKLMNOPQRSTUVWXYZ-Testcase2
      y=abcdefghijklmnopqrstuvwxyz-testcase2

        Attachments

        1. VELOCITY-655_ParameterProblem.vm
          0.2 kB
          Martin Schwaiger

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              amssrma Martin Schwaiger
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: