I upgraded to Velocity 1.5 and some of my templates started to fail.
Not sure if this represents an error in my existing templates, an
error in Velocity 1.5, or just one of those things that should be
documented.

From the Velocity 1.5 release notes:  "Line breaks are allowed in
directive calls, macro calls, method calls, and string literals".
This has caused a few of my templates to fail (templates that worked
with Velocity 1.4).

In my case, the context contains a variable named $method.  The
variable has typical method attributes such as name, returnType,
parameters, exception, and others.  The template that references this
item contains the following:

 public $method.returnType $method.name(
 #foreach($param in $parameters)
    ...
 #end

When run with Velocity 1.5, this template gets an error complaining
about the #foreach (at line 2 above).  Velocity was expecting a method
parameter.

I fixed the problem by adding curly braces on line 1 as follows:
 public $method.returnType ${method.name}(


I realize that newline processing changed in 1.5, but this caught me
by surprise.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to