[
https://issues.apache.org/jira/browse/VELOCITY-553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682195#action_12682195
]
Trejkaz commented on VELOCITY-553:
----------------------------------
What I find surprising about this is that it results in errors when checking
for existence of the object.
e.g., this works if you don't override the handler:
-- --
class A {
public String getValue() { return null; }
}
-- --
context.put("record", new A());
-- --
#if( $record.value )
$record. value
#end
-- --
But if you override the handler you will get an error from the #if line. So
even if you wanted to detect null values before you reference them, the normal
way of doing it in the template doesn't work either because you get an error
before you can.
> 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.7
>
>
> 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]