You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2009/08/06 12:53:53 UTC

svn commit: r801597 - /lenya/branches/BRANCH_2_0_X/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkConverter.java

Author: andreas
Date: Thu Aug  6 10:53:52 2009
New Revision: 801597

URL: http://svn.apache.org/viewvc?rev=801597&view=rev
Log:
Adding workaround for bug 47621: Use independent session for link rewriting.

Modified:
    lenya/branches/BRANCH_2_0_X/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkConverter.java

Modified: lenya/branches/BRANCH_2_0_X/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkConverter.java
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_0_X/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkConverter.java?rev=801597&r1=801596&r2=801597&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_0_X/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkConverter.java (original)
+++ lenya/branches/BRANCH_2_0_X/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkConverter.java Thu Aug  6 10:53:52 2009
@@ -24,8 +24,12 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
 import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentUtil;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.cms.repository.RepositoryUtil;
+import org.apache.lenya.cms.repository.Session;
 import org.apache.lenya.xml.DocumentHelper;
 import org.apache.xpath.XPathAPI;
 import org.w3c.dom.Attr;
@@ -86,7 +90,14 @@
                 ChainLinkRewriter incomingRewriter = new ChainLinkRewriter();
                 incomingRewriter.add(new RelativeToAbsoluteLinkRewriter(examinedDocument.getCanonicalWebappURL()));
                 incomingRewriter.add(new IncomingLinkRewriter(pub));
-                LinkRewriter urlToUuidRewriter = new UrlToUuidRewriter(examinedDocument.getFactory());
+
+                // Workaround:
+                // We create a new session because the sitetree of the transaction doesn't yet contain
+                // references to any new documents that were uploaded during the transaction.
+                // See https://issues.apache.org/bugzilla/show_bug.cgi?id=47621
+                Session readOnlySession = RepositoryUtil.createSession(this.manager, examinedDocument.getSession().getIdentity(), false);
+                DocumentFactory newFactory = DocumentUtil.createDocumentFactory(this.manager, readOnlySession);
+                LinkRewriter urlToUuidRewriter = new UrlToUuidRewriter(newFactory);
 
                 org.w3c.dom.Document xml = DocumentHelper.readDocument(examinedDocument
                         .getInputStream());



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org