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


      I've made a new patch that includes a ReferenceInsertionEventHandler ("InvalidReferenceHandler") that collects a list of all invalid references in a Velocity page.

      To see how it works, look at the test code (the last two methods) in BuiltInEventHandlerTestCase.

      To make this work, I had to make some changes to the internals. So I thought I'd hold off a couple days before committing, let any interested parties comment.

      There's a couple of interesting new pieces for plugin writers.

      (1) In any user-defined plugin (event handlers, uberspectors, etc) you can now throw a subclass of VelocityRuntimeException (new exception). to signal unrecoverable states to the calling application. This runtime exception requires no change to the interface signature and is passed through the Velocity parsing process. (In the past, all Exceptions were caught and logged).

      Example use: a custom uberspector or event handler that wishes to stop page processing. For example, the InvalidReferenceHandler can be configured to throw an exception at the first reference error.

      (2) Event handlers can now receive information on the template name, line number, and column by implementing InfoAware. This only works for Local event handlers attached to a context (as opposed to the new Global type defined in Velocity properties).

      Example use: InvalidReferenceHandler reports out the line,column, and template name of each reference error.

      Everything is completely backwards compatible. It'd be simpler if it wasn't of course as they we could just redo the interfaces.

      1. invalidreference.txt
        49 kB
        Will Glass-Husain


        Will Glass-Husain created issue -
        Will Glass-Husain made changes -
        Field Original Value New Value
        Attachment invalidreference.txt [ 12320789 ]
        Will Glass-Husain made changes -
        Assignee Will Glass-Husain [ wglass ]
        Will Glass-Husain made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Henning Schmiedehausen made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Will Glass-Husain made changes -
        Resolution Fixed [ 1 ]
        Status Reopened [ 4 ] Resolved [ 5 ]
        Henning Schmiedehausen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12343906 ] Default workflow, editable Closed status [ 12551285 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551285 ] jira [ 12552189 ]


          • Assignee:
            Will Glass-Husain
            Will Glass-Husain
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: