[
https://issues.apache.org/jira/browse/VELOCITY-739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772172#action_12772172
]
Byron Foster commented on VELOCITY-739:
---------------------------------------
My preference would be the current behavior. But, it's not a strong
preference, and if most people like the above described behavior, I would not
object.
My only argument is that it casts a wider net, and now all references with the
bang notation don't benefit as much from strict checking and error reporting.
I'v considered making it so that expressions that evaluate to null, simply
render as an empty string without error, which makes the current use of the
bang reference unnecessary. If someone did want stricter handling of nulls
they could do it through handlers.
I assume that the above behavior is only for the root variable, so given:
$!a.b
if 'a' is not in the context, then nothing is rendered. But if 'a' is defined
but does not contain the method 'b', or 'a' is null, then Velocity will throw
an error.
> Do not throw exception for quiet references in strict reference checking mode
> -----------------------------------------------------------------------------
>
> Key: VELOCITY-739
> URL: https://issues.apache.org/jira/browse/VELOCITY-739
> Project: Velocity
> Issue Type: Improvement
> Components: Engine
> Affects Versions: 1.6.2
> Reporter: Will Glass-Husain
>
> I used strict reference checking for the first time and discovered that it
> throws exceptions even for quiet references.
> <input class="signupInput" type="text" id="StxtFirstNames"
> name="firstName" value="$!user.firstName"/>
> org.apache.velocity.exception.MethodInvocationException: Variable
> $user has not been set at layout/slide_login.vm[line 13, column 117]
> This doesn't make sense to me. If a template author designates a reference
> as quiet, it's explicitly not an error. We're preventing the use of this
> convenient feature.
> It's not a hard change to fix this. Does it break backwards compatibility if
> we change this?
> Incidentally, there's an identical problem for InvalidReferenceEventHandler.
> I'll file a separate issue.
--
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]