[
https://issues.apache.org/jira/browse/VELOCITY-553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643202#action_12643202
]
Byron Foster commented on VELOCITY-553:
---------------------------------------
Really, strict mode VELOCITY-618 provides the functionality that I think the
creator of this issue seeks. I think several of us have gone down the road of
wanting strict type behavior and have looked into this to find that it doesn't
distinguish between and invalid reference, and a reference that returns null :(.
However, I think Will's comments above are exactly right for the desired
behavior, and it parallels the same cases in which strict mode throws
exceptions. ReportInvalidReference could be implemented as Will has outlined
by simply making the call at every point that strict mode throws an exception.
Further, you could replace all instances where strict mode throws exceptions
with a default implementation of ReportInvalidReference that throws an
exception. Even though you would have to augment the parameters passed so that
you could provide the same level of informative error messages. For 2.0 this
would make this type of handling nicely plugable. I would make strict the
default, and drop the option.. then people could use an "anything goes"
ReportInvalidReference if they wanted older behavior :)
> Posibility to configure ReportInvalidReferences to don't report report
> variables,properties and method which exist, but only have null value
> --------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: VELOCITY-553
> URL: https://issues.apache.org/jira/browse/VELOCITY-553
> Project: Velocity
> Issue Type: Improvement
> Components: Engine
> Affects Versions: 1.5
> Environment: any
> Reporter: Tomáš Procházka
> Fix For: 1.6
>
>
> ReportInvalidReferences has very big imperfection, it report by default all
> variables, properties and method which has null value.
> This may cause many problems for developer.
> I for example need only validate template without any data, only check which
> contain right variables, properties or method (which exist), it's value is
> not important for me.
> I tried use my own ReferenceInsertionEventHandler for replace null value with
> "" (empty String) but Velocity call InvalidReference handler before
> ReferenceInsertionEventHandler.
> I suggest configuration options for this (repor or doesn't report null value)
--
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]