svn commit: r611160 - /lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java

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

URL: http://svn.apache.org/viewvc?rev=611160&view=rev
Log:
Make pub config robust against empty publication name elements.

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

Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java?rev=611160&r1=611159&r2=611160&view=diff
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java Fri Jan 11 05:05:39 2008
@@ -136,7 +136,15 @@
         try {
             config = builder.buildFromFile(configFile);
 
-            this.name = config.getChild(ELEMENT_NAME).getValue();
+            String pubName = config.getChild(ELEMENT_NAME).getValue(null);
+            if (pubName == null) {
+                getLogger().warn("No publication name set for publication [" + getId() +
+                        "], using default name.");
+                this.name = "New Publication";
+            }
+            else {
+                this.name = pubName;
+            }
 
             try {
                 // one sanity check for the proper namespace. we should really
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.