Velocity 1.5 raises errors for templates that ran in 1.4.
---------------------------------------------------------

                 Key: VELOCITY-528
                 URL: https://issues.apache.org/jira/browse/VELOCITY-528
             Project: Velocity
          Issue Type: Bug
    Affects Versions: 1.5
         Environment: Windows XP SP2, JDK 1.5
            Reporter: Michael Giroux


Migrated from Velocity 1.4 to 1.5.  I have several templates that ran in 1.4 
and now fail in 1.5.  I raised this in the mailing list and Nathan Bubna asked 
me to file a bug.

This is probably an error in my template, but 1.4 allowed it to execute without 
complaints.  I might have been lucky that nothing bad happened.  

Existing templates contain the following.

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

The intent here is to emit a java method signature for a method named 
$method.name .  This works in 1.4.

In Velocity 1.5, an error is thrown indicating that the #foreach is unexpected. 
 Velocity 1.5 is expecting a method parameter becuase the variable name is 
terminated by an open paren.

I fixed the problem by adding curly braces to the template as follows:
 public $method.returnType ${method.name}(
 #foreach($param in $parameters)
    ...
 #end


This is probably a bug in 1.4, and poor coding practice in my template, but 
given the fact that it did work and now doesn't, there should be some mention 
of this "improvement" in the 1.5 release notes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to