You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Nathan Bubna <nb...@gmail.com> on 2010/03/26 18:52:30 UTC

Re: Small problem with undefined methods withing conditionals

Velocity stopped trying to ape WebMacro over a decade ago.

If you want to throw exceptions, turn on the strict reference mode (a
feature in Velocity 1.6) or in earlier versions, configure an event
handler to do what you wish.

On Wed, Feb 3, 2010 at 4:07 PM, Tim Pizey <ti...@paneris.org> wrote:
> Hi,
>
> I have just come across a difference in the behaviour  of WebMacro and Velocity 1.5:
>
> In the following template $object is expected to be an Exception:
>
> #if( $object.Message )
> $object.Message
> #end
>
> However if it is an Integer then this does not fail with an undefined property exception,
> as WebMacro does, it just silently ignores.
>
> http://velocity.apache.org/engine/devel/user-guide.html says:
>
> If a reference is used within a #if or #elseif directive without any methods or properties,
> and if it is not being compared to another value, then undefined references are allowed.
>
> I think that the documentation is correct and that this should throw an exception.
>
>
> cheers
> Tim
>
>
>
>
> --
> We are in dialogue.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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