roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r219104 - /incubator/roller/trunk/src/org/roller/presentation/velocity/PreviewServlet.java
Date Thu, 14 Jul 2005 21:23:51 GMT
Author: agilliland
Date: Thu Jul 14 14:23:47 2005
New Revision: 219104

URL: http://svn.apache.org/viewcvs?rev=219104&view=rev
Log:
bug fix for case when someone trys to preview a "custom" theme but has no page templates.
 we now return a 404 in this case.

Modified:
    incubator/roller/trunk/src/org/roller/presentation/velocity/PreviewServlet.java

Modified: incubator/roller/trunk/src/org/roller/presentation/velocity/PreviewServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/velocity/PreviewServlet.java?rev=219104&r1=219103&r2=219104&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/velocity/PreviewServlet.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/velocity/PreviewServlet.java Thu Jul
14 14:23:47 2005
@@ -10,7 +10,6 @@
 import javax.servlet.jsp.PageContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.velocity.exception.ResourceNotFoundException;
 import org.roller.ThemeNotFoundException;
 import org.roller.model.Roller;
 import org.roller.model.RollerFactory;
@@ -18,6 +17,7 @@
 import org.roller.model.UserManager;
 import org.roller.pojos.Theme;
 import org.roller.pojos.UserData;
+import org.roller.pojos.WeblogTemplate;
 import org.roller.pojos.WebsiteData;
 import org.roller.presentation.RollerRequest;
 
@@ -65,9 +65,9 @@
             // if we don't have a valid preview theme then
             // leave it up to our parent
             return super.handleRequest(request, response, ctx);
+            
         }
         
-        
         Template outty = null;
         Exception pageException = null;
         
@@ -99,15 +99,19 @@
             
             org.roller.model.Template page = null;
             
-            // If request specified the page, then go with that
             page = tmpWebsite.getDefaultPage();
-            rreq.setPage(page);
-            rreq.setWebsite(tmpWebsite);
             
-            // Still no page ID, then we have a problem
+            // Still no page ID ... probably someone with no templates
+            // trying to preview a "custom" theme
             if ( page == null ) {
-                throw new ResourceNotFoundException("Page not found");
+                // lets just call it a 404 and return
+                response.sendError(404);
+                return null;
             }
+            
+            // update our roller request object
+            rreq.setPage(page);
+            rreq.setWebsite(tmpWebsite);
 
             // this sets up the page we want to render
             outty = prepareForPageExecution(ctx, rreq, response, page);



Mime
View raw message