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

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
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()) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.