Velocity
  1. Velocity
  2. VELOCITY-685

BlockMacros fail with strict number of macro arguments

    Details

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

      Description

      With 'velocimacro.arguments.strict = true' the following VTL:

      #macro(foo)#end
      #@foo() junk #end

      Results in:

      Threw: class org.apache.velocity.exception.ParseErrorException
      Msg: VM #foo: too many arguments to macro. Wanted 0 got 1 at /foo.vm[line 2, column 1]
      org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:283)
      org.apache.velocity.runtime.directive.BlockMacro.render(BlockMacro.java:126)
      org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
      org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
      org.apache.velocity.Template.merge(Template.java:340)
      org.apache.velocity.Template.merge(Template.java:248)
      org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:343)

      1. velocity-685.patch
        2 kB
        Jarkko Viinamäki

        Activity

        Hide
        Byron Foster added a comment -

        Thanks for getting these fixed quickly

        Show
        Byron Foster added a comment - Thanks for getting these fixed quickly
        Hide
        Jarkko Viinamäki added a comment -

        Thanks for finding these bugs so quickly Byron! Good testing!

        Here's a patch that should fix the issue.

        Show
        Jarkko Viinamäki added a comment - Thanks for finding these bugs so quickly Byron! Good testing! Here's a patch that should fix the issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Byron Foster
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development