Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-16332

If a Wiki Component Listener is wrongly defined, it can get registered without getting unregistered on page deletion

    XMLWordPrintable

Details

    • Bug
    • Resolution: Solved By
    • Minor
    • None
    • 11.1
    • Component
    • Unknown
    • N/A
    • N/A

    Description

      Steps to reproduce

      • Create a WikiComponent Listener by following the steps described in a section of the tutorial on how to write an EvenListener, without adding any XWiki.ComponentMethodClass object.
      • The server log complains that the listener needs a "getName" method (as expected).
      • In a separate page, list the registered WikiComponents for instance with the script below: the WikiComponent that was created shows up.
      • Delete the WikiComponent page that was just created and reload the script listing the WikiComponents.

      Actual behaviour

      The created WikiComponent still shows up in the list of components while one would expect either that it gets unregistered on page deletion or that it doesn't get registered until it implements the required methods, wouldn't we?

      Utility script for listing registered WikiComponents

      {{groovy}}
      
      def listeners = services.component.componentManager.getInstanceList(org.xwiki.observation.EventListener.class)
      listeners.eachWithIndex {
        listener, index ->
        if (listener.toString().indexOf("DefaultWikiComponent@") >= 0) {
          println "* ${listener.documentReference}"
        }
      }
      
      {{/groovy}}
      

       

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              slauriere slauriere
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: