Velocity
  1. Velocity
  2. VELOCITY-438

toString is called twice on references

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.5
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Stephen Haberman
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development