toString is called twice on references
--------------------------------------

         Key: VELOCITY-438
         URL: http://issues.apache.org/jira/browse/VELOCITY-438
     Project: Velocity
        Type: Bug

    Versions: 1.5    
    Reporter: Stephen Haberman
 Attachments: call_tostring_only_once.txt

ASTReference.java has some null check logic that does, summarized:

if (value == null || value.toString() == null) {
   ...
} else {
  ... output value.toString();
}

Note value.toString() being called twice.

For strings and other primitives, this may not be a big deal, but I'm happily 
using Click, which puts full-fledged components into the velocity context that 
you render with "$componentName". Very slick. But now calling toString() 
multiple times isn't all that cool, both from perf and logic standpoints.

I've got a patch if I can figure out how to upload it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to