You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Will Glass-Husain (JIRA)" <ji...@apache.org> on 2006/03/19 16:56:00 UTC

[jira] Commented: (VELOCITY-435) ParseErrorException not thrown with #macro parse error

    [ http://issues.apache.org/jira/browse/VELOCITY-435?page=comments#action_12370990 ] 

Will Glass-Husain commented on VELOCITY-435:
--------------------------------------------

Hi,

Spent some time working on this, even coded a solution.  When I ran "ant test" though one of the Anakia tests failed due to an invalid macro call.

The problem is that there are likely thousands of Velocity templates out there with a macro argument problem.  If we put this error check in 1.5, then all those templates will suddenly fail.

I do think that throwing an error here would be very appropriate.  Maybe we need to add a "strict mode" property that will throw errors for invalid macro calls and invalid references.

Comments?

> ParseErrorException not thrown with #macro parse error
> ------------------------------------------------------
>
>          Key: VELOCITY-435
>          URL: http://issues.apache.org/jira/browse/VELOCITY-435
>      Project: Velocity
>         Type: Bug
>     Versions: 1.5
>  Environment: Windows XP, JDK 1.4.2_09
>     Reporter: Malcolm Edgar
>      Fix For: 1.5

>
> I have just been reviewing the new error handlingin Velocity 1.5-dev.
> One change I have observed it that an invalid macro call, passing 2
> arguments instead of one will log an error message:
> [Velocity] [error] VM #writeForm: error : too many arguments to macro.
> Wanted 1 got 2
> [Velocity] [error] VM error writeForm. Null AST
> However it will not throw an ParseErrorException like it used to in
> 1.5-dev. Please see the example below for the earlier behaviour:
> http://www.sunvolt.com/click-examples/exception.htm?actionLink=brokenBorderLink#
> I prefer earlier approach, as the error is explicit. The new approach
> logs an error message, but beyond that you would not have known that
> an error occured. The #writeForm() call is not even rendered, as is
> done with an invalid object reference.
> regards Malcolm Edgar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org