Re: [xwiki-devs] [xwiki-notifications] r9982 - xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki
On May 29, 2008, at 11:41 PM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2008-05-29 23:41:59 +0200 (Thu, 29 May 2008) New Revision: 9982
Modified: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ XWiki.java Log: XWIKI-2415: Sending notifications fails when restoring documents from the recycle bin Fixed.
Modified: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/ xwiki/XWiki.java =================================================================== --- xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ XWiki.java 2008-05-29 21:10:01 UTC (rev 9981) +++ xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ XWiki.java 2008-05-29 21:41:59 UTC (rev 9982) @@ -1113,6 +1113,12 @@ // We need to save the original document since saveXWikiDoc() will reset it and we // need that original document for the notification below. XWikiDocument originalDocument = doc.getOriginalDocument(); + // Always use an originalDocument, to provide a consistent behavior. The cases where + // originalDocument is null are rare (specifically when the XWikiDocument object is + // manually constructed, and not obtained using the API). + if (originalDocument == null) { + originalDocument = new XWikiDocument(doc.getSpace(), doc.getName()); + }
// Notify listeners about the document change if (originalDocument == null || originalDocument.isNew()) {
hmmm... this doesn't look correct. You're forcing the originalDocument to be not null but then next says: if originalDocument is null... Thanks -Vincent
On May 30, 2008, at 8:36 AM, Vincent Massol wrote:
On May 29, 2008, at 11:41 PM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2008-05-29 23:41:59 +0200 (Thu, 29 May 2008) New Revision: 9982
Modified: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ XWiki.java Log: XWIKI-2415: Sending notifications fails when restoring documents from the recycle bin Fixed.
Modified: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/ xpn/xwiki/XWiki.java =================================================================== --- xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/ xwiki/XWiki.java 2008-05-29 21:10:01 UTC (rev 9981) +++ xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/ xwiki/XWiki.java 2008-05-29 21:41:59 UTC (rev 9982) @@ -1113,6 +1113,12 @@ // We need to save the original document since saveXWikiDoc() will reset it and we // need that original document for the notification below. XWikiDocument originalDocument = doc.getOriginalDocument(); + // Always use an originalDocument, to provide a consistent behavior. The cases where + // originalDocument is null are rare (specifically when the XWikiDocument object is + // manually constructed, and not obtained using the API). + if (originalDocument == null) { + originalDocument = new XWikiDocument(doc.getSpace(), doc.getName()); + }
// Notify listeners about the document change if (originalDocument == null || originalDocument.isNew()) {
hmmm... this doesn't look correct. You're forcing the originalDocument to be not null but then next says: if originalDocument is null...
Seen your following email that fixed it... Dunno why but my emails are arriving by batch this morning, like one to 5 each time I do a pop. Probably a gmail new "feature"... Thanks -Vincent
Vincent Massol wrote:
On May 30, 2008, at 8:36 AM, Vincent Massol wrote:
On May 29, 2008, at 11:41 PM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2008-05-29 23:41:59 +0200 (Thu, 29 May 2008) New Revision: 9982
Modified: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ XWiki.java Log: XWIKI-2415: Sending notifications fails when restoring documents from the recycle bin Fixed.
Modified: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/ xpn/xwiki/XWiki.java =================================================================== --- xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/ xwiki/XWiki.java 2008-05-29 21:10:01 UTC (rev 9981) +++ xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/ xwiki/XWiki.java 2008-05-29 21:41:59 UTC (rev 9982) @@ -1113,6 +1113,12 @@ // We need to save the original document since saveXWikiDoc() will reset it and we // need that original document for the notification below. XWikiDocument originalDocument = doc.getOriginalDocument(); + // Always use an originalDocument, to provide a consistent behavior. The cases where + // originalDocument is null are rare (specifically when the XWikiDocument object is + // manually constructed, and not obtained using the API). + if (originalDocument == null) { + originalDocument = new XWikiDocument(doc.getSpace(), doc.getName()); + }
// Notify listeners about the document change if (originalDocument == null || originalDocument.isNew()) { hmmm... this doesn't look correct. You're forcing the originalDocument to be not null but then next says: if originalDocument is null...
Seen your following email that fixed it... Dunno why but my emails are arriving by batch this morning, like one to 5 each time I do a pop. Probably a gmail new "feature"...
Because I usually have several changes in my dev trunks, I often manually merge changes into my clean trunks and commit from there, and I simply forgot to also copy the modified if. Indeed, I fixed the if in the next commit. -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
Sergiu Dumitriu -
Vincent Massol