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 2008/02/13 01:29:57 UTC
svn commit: r627201 -
/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java
Author: andreas
Date: Tue Feb 12 16:29:56 2008
New Revision: 627201
URL: http://svn.apache.org/viewvc?rev=627201&view=rev
Log:
DocumentSourceFactory: throw SourceNotFoundException instead of NPE if the link target doesn't exist.
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=627201&r1=627200&r2=627201&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 Tue Feb 12 16:29:56 2008
@@ -38,6 +38,7 @@
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceException;
import org.apache.excalibur.source.SourceFactory;
+import org.apache.excalibur.source.SourceNotFoundException;
import org.apache.excalibur.source.SourceResolver;
import org.apache.lenya.cms.linking.Link;
import org.apache.lenya.cms.linking.LinkResolver;
@@ -136,6 +137,10 @@
contextualize(link, webappUrl);
target = resolver.resolve(factory, link.getUri());
}
+
+ if (!target.exists()) {
+ throw new SourceNotFoundException("Source not found: [" + location + "]");
+ }
Document doc = target.getDocument();
@@ -160,7 +165,8 @@
}
return this.sourceResolver.resolveURI(lenyaURL);
}
-
+ } catch (SourceException e) {
+ throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org