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/05/02 08:33:42 UTC

svn commit: r534331 - /lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java

Author: andreas
Date: Tue May  1 23:33:41 2007
New Revision: 534331

URL: http://svn.apache.org/viewvc?view=rev&rev=534331
Log:
Throw exception when trying to delete referenced document, don't use source URL to access a node (fixes bug 42300).

Modified:
    lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java

Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java?view=diff&rev=534331&r1=534330&r2=534331
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java Tue May  1 23:33:41 2007
@@ -233,11 +233,10 @@
             if (sourceExtension.equals("xml") || sourceExtension.equals("")) {
                 getLogger().info("Default extension will be used: " + defaultExtension);
                 return defaultExtension;
-            }
-            else {
+            } else {
                 return sourceExtension;
             }
-            
+
         }
         return this.extension;
     }
@@ -396,6 +395,10 @@
      * @see org.apache.lenya.cms.publication.Document#delete()
      */
     public void delete() throws DocumentException {
+        if (hasLink()) {
+            throw new DocumentException("Can't delete document [" + this
+                    + "], it's still referenced in the site structure.");
+        }
         try {
             getRepositoryNode().delete();
         } catch (Exception e) {
@@ -494,12 +497,7 @@
     }
 
     public boolean existsTranslation(String language) {
-        String sourceUri = getSourceURI(getPublication(), getArea(), getUUID(), language);
-        try {
-            return SourceUtil.exists(sourceUri, this.manager);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
+        return area().contains(getUUID(), language);
     }
 
     public Document getAreaVersion(String area) throws DocumentException {
@@ -519,7 +517,7 @@
     }
 
     private Node repositoryNode;
-    
+
     /**
      * @see org.apache.lenya.cms.publication.Document#getRepositoryNode()
      */



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