You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Christoph Reck (JIRA)" <de...@velocity.apache.org> on 2009/02/10 18:58:59 UTC
[jira] Issue Comment Edited: (VELOCITY-688) ! preceding a reference
in strict mode ignores a null exception
[ https://issues.apache.org/jira/browse/VELOCITY-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12672333#action_12672333 ]
chreck edited comment on VELOCITY-688 at 2/10/09 9:58 AM:
------------------------------------------------------------------
The original intent of the bang syntax ($!foo) - it is to allow the template writer to say "this may be null".
Without strict mode, $!foo will not log anything if it is undefined or null.
I have not used the strict mode, so I have not considered what to do then for a $foo that is undefined or null. I do agree with Nathan that a $foo null reference in strict mode should throw an exception as originally devised. A $!foo null reference in strict mode could output nothing or throw an exception (no preference here).
was (Author: chreck):
This is the original intent of the bang syntax - it is to allow the template writer to say "this may be null".
Without strict mode, $!foo will not log anything if it is undefined or null.
I have not used the strict mode, so I have not considered what to do then for a $foo that is undefined or null. I do agree with Nathan that a $foo null reference in strict mode should throw an exception as originally devised. A $!foo null reference in strict mode should output nothing or throw an exception (no preference here).
> ! preceding a reference in strict mode ignores a null exception
> ---------------------------------------------------------------
>
> Key: VELOCITY-688
> URL: https://issues.apache.org/jira/browse/VELOCITY-688
> Project: Velocity
> Issue Type: Improvement
> Components: Engine
> Affects Versions: 1.7
> Reporter: Byron Foster
> Fix For: 1.7
>
>
> Change strict mode (runtime.references.strict = true) behavior such that when Velocity attempts to render a reference that evaluates to null then throw an exception. If the reference is preceded by '$!' as in $!foo, then simply render nothing and ignore the null value as it does for non strict mode.
--
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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org