Velocity
  1. Velocity
  2. VELOCITY-565

EvaluateContext does not take account of inner.localContext

    Details

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

      Description

      the following vtl does not render what is, IMHO, expected :

      #macro(testEval $expr)

      #foreach($value in ["val1", "val2"])
      value is : #evaluate( $expr )
      #end
      #end

      #testEval( "$

      {value}" )

      renders :

      value is : ${value}

      value is : $

      {value}

      The reason is that EvaluateContext ctor assigns 'inner.getBaseContext()'
      to instance variable 'innerContext', and getBaseContext() does not
      return VMContext localContext refs (of the #foreach directive).

      Changing the EvaluateContext ctor so that 'innerContext' is set to
      'inner' allow velocity to render the right result :

      value is : val1
      value is : val2

      But I'm not sure this would be a correct fix, should the VMContext
      return all current refs ? Could you tell me what the normal behavior is
      and what is the way all that stuff sould work ?

      Etienne Massip

      1. evalvmcontext.patch
        3 kB
        Etienne Massip
      2. EvaluateContext.java
        10 kB
        Etienne Massip

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Will Glass-Husain
            Reporter:
            Will Glass-Husain
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development