[
https://issues.apache.org/jira/browse/VELOCITY-553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claude Brisson resolved VELOCITY-553.
-------------------------------------
Resolution: Fixed
I'm in the process of reviewing some old issues... this one was a good
candidate for 2.x.
Here's what I did, it should correspond to what emerged in the comments:
$invalid => triggers invalid ref
$nullvalue => silent
$valid.nullProp => silent
$valid.nullMethod => silent
$valid.invalid => triggers invalid ref
That is, null is now always considered a legitimate final value.
For #if / #elseif :
#if($invalid) => silent
#if($valid.invalid) => silent
#if($invalid.prop) => triggers invalid ref
#if($valid.invalid.prop) => triggers invalid ref
Tests that trigger the invalid reference can all be rewritten so that they
don't:
#if($invalid && $invalid.prop) => silent
#if($valid && $valid.invalid && $valid.invalid.prop) => silent
Thanks to Renato Steiner for his test case patch.
> 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: 2.x
>
> Attachments: InvalidEventHandlerTestCase.java.patch
>
>
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]