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 2007/08/29 12:46:44 UTC

svn commit: r570749 - /lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java

Author: andreas
Date: Wed Aug 29 03:46:36 2007
New Revision: 570749

URL: http://svn.apache.org/viewvc?rev=570749&view=rev
Log:
Avoid exception for lenya-document URLs on non-document URLs (fixes bug 43227).

Modified:
    lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java

Modified: lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java?rev=570749&r1=570748&r2=570749&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java (original)
+++ lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java Wed Aug 29 03:46:36 2007
@@ -124,9 +124,15 @@
             resolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE);
             DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
             String webappUrl = ServletHelper.getWebappURI(request);
-            Document currentDoc = factory.getFromURL(webappUrl);
+            LinkTarget target;
+            if (factory.isDocument(webappUrl)) {
+                Document currentDoc = factory.getFromURL(webappUrl);
+                target = resolver.resolve(currentDoc, linkUri);
+            }
+            else {
+                target = resolver.resolve(factory, linkUri);
+            }
 
-            LinkTarget target = resolver.resolve(currentDoc, linkUri);
             Document doc = target.getDocument();
 
             if (target.isRevisionSpecified()) {



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