On May 15, 2009, at 2:47 AM, sdumitriu (SVN) wrote:
Author: sdumitriu
Date: 2009-05-15 02:47:38 +0200 (Fri, 15 May 2009)
New Revision: 19992
Modified:
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/
DefaultDocumentAccessBridge.java
Log:
XWIKI-3521: Include Macro uses same revision number for included
page as the current page
Fixed.
Patch submitted by Anamaria Stoica, applied without changes.
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/
doc/DefaultDocumentAccessBridge.java
===================================================================
--- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/
DefaultDocumentAccessBridge.java 2009-05-15 00:47:33 UTC (rev 19991)
+++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/
DefaultDocumentAccessBridge.java 2009-05-15 00:47:38 UTC (rev 19992)
@@ -123,7 +123,15 @@
public String getDocumentContent(String documentName, String
language) throws Exception
{
XWikiContext xcontext = getContext();
- return xcontext.getWiki().getDocument(documentName,
xcontext).getTranslatedContent(language, xcontext);
+ String originalRev = (String) xcontext.get("rev");
+ try {
+ xcontext.remove("rev");
+ return xcontext.getWiki().getDocument(documentName,
xcontext).getTranslatedContent(language, xcontext);
+ } finally {
+ if (originalRev != null) {
+ xcontext.put("rev", originalRev);
+ }
+ }
This is missing documentation. It's not obvious why 1) there's a rev
value in the context and 2) why you have to remove it and set it back.
Thanks
-Vincent