svn commit: r611162 - /lenya/trunk/src/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Fri Jan 11 05:06:13 2008
New Revision: 611162

URL: http://svn.apache.org/viewvc?rev=611162&view=rev
Log:
Set default publication name in instantiator if empty name was passed.

Modified:
    lenya/trunk/src/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java

Modified: lenya/trunk/src/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java?rev=611162&r1=611161&r2=611162&view=diff
==============================================================================
--- lenya/trunk/src/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java (original)
+++ lenya/trunk/src/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java Fri Jan 11 05:06:13 2008
@@ -47,6 +47,7 @@
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.PublicationManager;
 // import org.apache.lenya.cms.publication.PublicationConfiguration;
+import org.apache.lenya.util.Assert;
 import org.apache.lenya.xml.DocumentHelper;
 import org.apache.lenya.xml.NamespaceHelper;
 import org.w3c.dom.Document;
@@ -94,6 +95,14 @@
      */
     public void instantiate(Publication template, String newPublicationId, String name)
             throws Exception {
+        
+        Assert.notNull("template", template);
+        Assert.notNull("publication ID", newPublicationId);
+        Assert.notNull("name", name);
+        
+        if (name.equals("")) {
+            name = "New Publication";
+        }
 
         SourceResolver resolver = null;
         Source publicationsSource = null;
@@ -114,7 +123,7 @@
                     copySource(template, newPublicationId, resolver, publicationsUri, source);
                 }
             }
-
+            
             updateMetaData(resolver, newPublicationId, name, publicationsUri);
 
             configureSearchIndex(resolver, template, newPublicationId, publicationsUri);
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.