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/11/16 10:24:47 UTC

svn commit: r595608 - /lenya/trunk/src/java/org/apache/lenya/cms/site/AbstractLink.java

Author: andreas
Date: Fri Nov 16 01:24:46 2007
New Revision: 595608

URL: http://svn.apache.org/viewvc?rev=595608&view=rev
Log:
AbstractLink: throw UnsupportedOperationException in getDocument() if node has no UUID.

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/site/AbstractLink.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/AbstractLink.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/site/AbstractLink.java?rev=595608&r1=595607&r2=595608&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/AbstractLink.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/AbstractLink.java Fri Nov 16 01:24:46 2007
@@ -101,10 +101,15 @@
     private DocumentFactory factory;
 
     public Document getDocument() {
-        Publication pub = getNode().getStructure().getPublication();
-        String area = getNode().getStructure().getArea();
+        SiteNode node = getNode();
+        String uuid = node.getUuid();
+        if (uuid == null) {
+            throw new UnsupportedOperationException("The node [" + node + "] has no UUID.");
+        }
+        Publication pub = node.getStructure().getPublication();
+        String area = node.getStructure().getArea();
         try {
-            return this.factory.get(pub, area, getNode().getUuid(), getLanguage());
+            return this.factory.get(pub, area, uuid, getLanguage());
         } catch (DocumentBuildException e) {
             throw new RuntimeException(e);
         }
@@ -121,4 +126,4 @@
 
     protected void save() {}
     
-}
+}
\ No newline at end of file



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