Hi Peter,

> On 05 Apr 2016, at 19:28, Peter Huisman <p.huis...@ximm.nl> wrote:
> From the XWiki source code, I see there is a difference in passing a document 
> to the evenmanager:
> The DocumentDeletingEvent is passing a “new 
> XWikiDocument(doc.getDocumentReference())"
> The DocumentUpdatedEvent (as an example) is passing the doc (the actual 
> XWikiDocument) 
> The difference is, that the Document passed in the DeleteEvent is a new 
> XWikiDocument and not the XWikiDocument that is about to be deleted.
> Is there a reason why this difference exists?

he code in the XWiki class doing the notify has been there for a long time 

om.notify(new DocumentDeletingEvent(doc.getDocumentReference()),
    new XWikiDocument(doc.getDocumentReference()), context);

However, I think it’s not correct. I think it should pass the document and not 
a clone, because an Event Listener should be able to modify the instance that’s 
going to be saved.

So I’d open a bug for this. Let’s see if the others agree.


> Br,
> Peter

users mailing list

Reply via email to