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 2005/07/28 18:55:51 UTC

svn commit: r225817 - /incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java

Author: agilliland
Date: Thu Jul 28 09:55:49 2005
New Revision: 225817

URL: http://svn.apache.org/viewcvs?rev=225817&view=rev
Log:
fixed bug in customize method where an error would get thrown if someone managed to try and customize their "custom" theme.

Modified:
    incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java

Modified: incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java?rev=225817&r1=225816&r2=225817&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java Thu Jul 28 09:55:49 2005
@@ -309,20 +309,36 @@
                 
                 String username = rreq.getUser().getUserName();
                 WebsiteData website = roller.getUserManager().getWebsite(username);
-                Theme usersTheme = themeMgr.getTheme(website.getEditorTheme());
-
-                // only if custom themes are allowed
-                if(RollerRuntimeConfig.getBooleanProperty("themes.customtheme.allowed")) {
-                    try {
-                        this.saveThemePages(website, usersTheme);
-                    } catch(RollerException re) {
-                        mLogger.error(re);
-                        errors.add(null, new ActionMessage("Error customizing theme"));
-                        saveErrors(request, errors);
+                
+                try {
+                    Theme usersTheme = themeMgr.getTheme(website.getEditorTheme());
+                    
+                    // only if custom themes are allowed
+                    if(RollerRuntimeConfig.getBooleanProperty("themes.customtheme.allowed")) {
+                        try {
+                            this.saveThemePages(website, usersTheme);
+                        } catch(RollerException re) {
+                            mLogger.error(re);
+                            errors.add(null, new ActionMessage("Error customizing theme"));
+                            saveErrors(request, errors);
+                        }
+                        
+                        // make sure to flush the page cache so ppl can see the change
+                        PageCacheFilter.removeFromCache(request, rreq.getUser());
                     }
                     
-                    // make sure to flush the page cache so ppl can see the change
-                    PageCacheFilter.removeFromCache(request, rreq.getUser());
+                } catch(ThemeNotFoundException tnfe) {
+                    // this catches the potential case where someone customizes
+                    // a theme and has their theme as "custom" but then hits the
+                    // browser back button and presses the button again, so
+                    // they are basically trying to customize a "custom" theme
+                    
+                    // log this as a warning just in case
+                    mLogger.warn(tnfe);
+                    
+                    // show the user an error message and let things go back
+                    // to the edit page
+                    errors.add(null, new ActionMessage("Oops!  You already have a custom theme."));
                 }
                 
                 // just take the user back home to the edit theme page