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

Nathan Bubna commented on VELOCITY-656:
---------------------------------------

No, no new interfaces.  I'm not even much a fan of TemplateNumber.  I prefer 
reflection and convention to avoid hard dependencies on Velocity APIs.  Version 
compatibility is much easier on both sides when you test for the presence of 
the feature directly, rather than rely on interfaces.  We're moving into 2.0 
discussion again, but really, i would prefer to watch for methods like 
getAsNumber(), getAsBoolean(), and getAsString() for such things.

In the 1.x frame, we must still allow/expect toString() to return null.   Since 
we're looking at a 1.6.2 release, you might as well commit your try/catch 
exception wrapping for this into the trunk and merge it to the 1.6.x branch.  
My main reason for marking this as a 1.7 fix was that i didn't think it worth 
rebuilding 1.6.1 for this, and i didn't yet envision a 1.6.2.

> Wrap ref evaluate exception so vm location is revealed
> ------------------------------------------------------
>
>                 Key: VELOCITY-656
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-656
>             Project: Velocity
>          Issue Type: Improvement
>    Affects Versions: 1.6, 1.6.1, 1.7
>            Reporter: Byron Foster
>             Fix For: 1.7
>
>         Attachments: 656.patch
>
>
> The following VTL calls the toString() method on the object in $foo:
> #if($foo)#end  
> If the toString() method throws an exception, the exception is thrown all the 
> way out of velocity without any indication of where the vtl reference 
> occurred.  This patch wraps the exception with a VelocityException with a 
> message that indicates the location of the offending reference.
> However, I wonder why toString() is called at all...  the code tests for 
> toString() == null and returns false if so, and true otherwise in the above 
> example vtl.  Why is this test necessary, and why isn't just a non-null 
> object enough for testing?

-- 
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: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to