You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/04/18 18:56:08 UTC

svn commit: r530088 - in /roller/trunk/src/org/apache/roller/business/themes: SharedThemeFromDir.java ThemeInitializationException.java

Author: agilliland
Date: Wed Apr 18 09:56:07 2007
New Revision: 530088

URL: http://svn.apache.org/viewvc?view=rev&rev=530088
Log:
If there is a problem loading a theme xml descriptor then throw an exception and so that the broken theme doesn't remain in the theme list.


Added:
    roller/trunk/src/org/apache/roller/business/themes/ThemeInitializationException.java
Modified:
    roller/trunk/src/org/apache/roller/business/themes/SharedThemeFromDir.java

Modified: roller/trunk/src/org/apache/roller/business/themes/SharedThemeFromDir.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/themes/SharedThemeFromDir.java?view=diff&rev=530088&r1=530087&r2=530088
==============================================================================
--- roller/trunk/src/org/apache/roller/business/themes/SharedThemeFromDir.java (original)
+++ roller/trunk/src/org/apache/roller/business/themes/SharedThemeFromDir.java Wed Apr 18 09:56:07 2007
@@ -65,7 +65,9 @@
     private Map resources = new HashMap();
     
     
-    public SharedThemeFromDir(String themeDirPath) {
+    public SharedThemeFromDir(String themeDirPath) 
+            throws ThemeInitializationException {
+        
         this.themeDir = themeDirPath;
         
         // load the theme elements and cache 'em
@@ -174,7 +176,7 @@
     /**
      * Load all the elements of this theme from disk and cache them.
      */
-    private void loadThemeFromDisk() {
+    private void loadThemeFromDisk() throws ThemeInitializationException {
         
         log.debug("Parsing theme descriptor for "+this.themeDir);
         
@@ -185,8 +187,7 @@
             InputStream is = new FileInputStream(this.themeDir + File.separator + "theme.xml");
             themeMetadata = parser.unmarshall(is);
         } catch (Exception ex) {
-            log.warn("Unable to parse theme descriptor for theme "+this.themeDir, ex);
-            return;
+            throw new ThemeInitializationException("Unable to parse theme descriptor for theme "+this.themeDir, ex);
         }
         
         log.debug("Loading Theme "+themeMetadata.getName());

Added: roller/trunk/src/org/apache/roller/business/themes/ThemeInitializationException.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/themes/ThemeInitializationException.java?view=auto&rev=530088
==============================================================================
--- roller/trunk/src/org/apache/roller/business/themes/ThemeInitializationException.java (added)
+++ roller/trunk/src/org/apache/roller/business/themes/ThemeInitializationException.java Wed Apr 18 09:56:07 2007
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.business.themes;
+
+import org.apache.roller.RollerException;
+
+
+/**
+ * Thrown when there is a problem initalizing a theme object.
+ */
+public class ThemeInitializationException extends RollerException {
+    
+    
+    public ThemeInitializationException(String s,Throwable t) {
+        super(s, t);
+    }
+    
+    public ThemeInitializationException(Throwable t) {
+        super(t);
+    }
+    
+    public ThemeInitializationException(String s) {
+        super(s);
+    }
+    
+    public ThemeInitializationException() {
+        super();
+    }
+    
+}