Velocity
  1. Velocity
  2. VELOCITY-591

#evaluate directive is wiping out macros

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      JDK 1.5

      Description

      I think I've found a problem with the new #evaluate directive in 1.6. It seems like a call to #evaluate is causing the macros that have already been defined to be cleared. Here is a test template to demonstrate:

      #macro (test $t)
      test: #evaluate($t)
      #end

      #macro (test2 $t)
      test2: #evaluate($t)
      #end

      #evaluate("Will Clear Macros")

      #test("hi world 1")
      #test2("hi world 2")

      -------------------------------

      My overall major goal is to have a template be able to render other VTL that is pulled from objects. The problem with the RenderTool is that it doesn't share the same macros as the parent. That's why I'm trying to go down the route of using the new #evaluate directive since in theory both the macro and context are shared.

        Activity

        Jonathan Tew created issue -
        Hide
        Will Glass-Husain added a comment -

        Hi,

        Tested this - it works fine. See the new test EvaluateTestCase.testEvaluateMacroPreserve().

        I'm guessing fixes for other bugs took care of this problem.

        If you still have problems, reopen. Ideally modify the test case so it breaks.

        Show
        Will Glass-Husain added a comment - Hi, Tested this - it works fine. See the new test EvaluateTestCase.testEvaluateMacroPreserve(). I'm guessing fixes for other bugs took care of this problem. If you still have problems, reopen. Ideally modify the test case so it breaks.
        Will Glass-Husain made changes -
        Field Original Value New Value
        Fix Version/s 1.6 [ 12310290 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Workflow jira [ 12427884 ] Default workflow, editable Closed status [ 12551550 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551550 ] jira [ 12552435 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Jonathan Tew
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development