You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Stephen Haberman (JIRA)" <ji...@apache.org> on 2006/04/18 07:36:17 UTC

[jira] Created: (VELOCITY-438) toString is called twice on references

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


[jira] Updated: (VELOCITY-438) toString is called twice on references

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-438?page=all ]

Will Glass-Husain updated VELOCITY-438:
---------------------------------------

    Fix Version: 1.5

Thanks for the catch!  I'll go ahead and commit this.

Appreciate the unit test.  Just as a quick side note, when submitting patches please remember to follow the Velocity coding convention for braces.  I'll fix this when I commit.


> 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
>      Fix For: 1.5
>  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: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Resolved: (VELOCITY-438) toString is called twice on references

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-438?page=all ]

Will Glass-Husain resolved VELOCITY-438.
----------------------------------------

    Resolution: Fixed

patched applied.  sorry for the long delay.  Thanks to Stephen for the patch (and Malcolm for the reminder :-)

> toString is called twice on references
> --------------------------------------
>
>                 Key: VELOCITY-438
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-438
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.5
>            Reporter: Stephen Haberman
>             Fix For: 1.5
>
>         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: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Closed: (VELOCITY-438) toString is called twice on references

Posted by "Henning Schmiedehausen (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henning Schmiedehausen closed VELOCITY-438.
-------------------------------------------


> toString is called twice on references
> --------------------------------------
>
>                 Key: VELOCITY-438
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-438
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.5
>            Reporter: Stephen Haberman
>             Fix For: 1.5
>
>         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.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (VELOCITY-438) toString is called twice on references

Posted by "Stephen Haberman (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-438?page=all ]

Stephen Haberman updated VELOCITY-438:
--------------------------------------

    Attachment: call_tostring_only_once.txt

Patch ASTReference to not call value.toString() multiple times.

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


[jira] Commented: (VELOCITY-438) toString is called twice on references

Posted by "Henning Schmiedehausen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-438?page=comments#action_12430077 ] 
            
Henning Schmiedehausen commented on VELOCITY-438:
-------------------------------------------------

Will commented that the patch is ok and he wants to put it in. Will? Did this fall through the cracks?

> toString is called twice on references
> --------------------------------------
>
>                 Key: VELOCITY-438
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-438
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.5
>            Reporter: Stephen Haberman
>             Fix For: 1.5
>
>         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: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org