Details
-
Bug
-
Resolution: Solved By
-
Minor
-
None
-
11.1
-
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
- depends on
-
XCOMMONS-1652 Protect against EventListeners having getName() or getEvents() methods throwing runtime exceptions
- Closed