Thanks, Michael! On 3/12/07, Michael Giroux <[EMAIL PROTECTED]> wrote:
https://issues.apache.org/jira/browse/VELOCITY-528On 3/12/07, Nathan Bubna <[EMAIL PROTECTED]> wrote: > On 3/12/07, Michael Giroux <[EMAIL PROTECTED]> wrote: > > 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 > > i'm fairly surprised that this ever worked before. i would have > expected the parser to complain that it hit a new line instead of a > ')' at the end of the first line above. it looks like an incomplete > call to method 'name()' on reference 'method'. unfortunately it > looked like the parser unfortunately used to be gracious in this case. > > i would call this a bug/loophole in Velocity 1.4 and earlier that let > you do that. > > > 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. > > seems like the right response to me. we now allow line breaks in > method calls (such as a call to $method.name()), but we still *don't* > allow raw directives (e.g. $method.name(#foreach( $foo in $bar > )$foo#end) ) in them. > > > I fixed the problem by adding curly braces on line 1 as follows: > > public $method.returnType ${method.name}( > > yeah, this is really the way this ought to have been done all along. > > > I realize that newline processing changed in 1.5, but this caught me > > by surprise. > > sorry about that. :( would you file a case about this? even though > this is more of a pre-1.5 bug and 1.5 is doing the right thing, the > fact that we've broken templates that worked before means we should > warn people about this in the release notes somewhere. > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
