Velocity
  1. Velocity
  2. VELOCITY-656

Wrap ref evaluate exception so vm location is revealed

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6, 1.6.1, 1.7
    • Fix Version/s: 1.7
    • Component/s: None
    • Labels:
      None

      Description

      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?

      1. 656.patch
        0.9 kB
        Byron Foster

        Activity

        Byron Foster created issue -
        Byron Foster made changes -
        Field Original Value New Value
        Attachment 656.patch [ 12395743 ]
        Nathan Bubna made changes -
        Affects Version/s 1.6 [ 12310290 ]
        Fix Version/s 1.7 [ 12313453 ]
        Affects Version/s 1.7 [ 12313453 ]
        Byron Foster made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Workflow jira [ 12448179 ] Default workflow, editable Closed status [ 12551377 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551377 ] jira [ 12552082 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Byron Foster
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development