You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Claude Brisson (JIRA)" <ji...@apache.org> on 2016/07/18 20:22:20 UTC

[jira] [Commented] (VELOCITY-800) Subsequent invalid references cannot be resolved by InvalidReferenceEventHandler.invalidGetMethod

    [ https://issues.apache.org/jira/browse/VELOCITY-800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15382990#comment-15382990 ] 

Claude Brisson commented on VELOCITY-800:
-----------------------------------------

I see two problems with your patch:

 - it doesn't handle the $invalid.prop case, only $valid.invalid.invalid case
 - it calculates the reference full name for *every* reference, which looks like overkill (we'd like to only calculate it whenever we encounter a null)

There are other considerations about this feature:

 - how should tests on references behave? should #if($invalid) or #if($valid.invalid.invalid) also use the event handler and use its result? It's not the case for now.
 - would strict mode be impacted? Right now, strict mode and invalid reference events are orthogonal features.

At start, this event handler was thought as a debugging feature, and not meant to include business logic. If you still think it's pertinent, could you elaborate a bit on your use case? Are you sure there isn't any easier way of handling it? For instance, have you considered using a custom uberspector?




> Subsequent invalid references cannot be resolved by InvalidReferenceEventHandler.invalidGetMethod
> -------------------------------------------------------------------------------------------------
>
>                 Key: VELOCITY-800
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-800
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.7
>            Reporter: Quintin Siebers
>            Priority: Minor
>              Labels: event, invalid, method, reference, resolve
>         Attachments: SubsequentInvalidReferenceEventHandlerTest.java, VELOCITY-800.patch
>
>
> If $foo is a java.lang.String and a template tried to do $foo.bar, one can use an InvalidReferenceEventHandler to resolve bar into a value. However, if the template tries to do $foo.bar.baz, the last part cannot be resolved using an InvalidReferenceEventHandler. I'll attach an example test case.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org