roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r225817 - /incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java
Date Thu, 28 Jul 2005 16:55:51 GMT
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



Mime
View raw message