You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2010/05/30 06:13:27 UTC

svn commit: r949468 - /click/trunk/click/framework/src/org/apache/click/ClickServlet.java

Author: sabob
Date: Sun May 30 04:13:26 2010
New Revision: 949468

URL: http://svn.apache.org/viewvc?rev=949468&view=rev
Log:
guard against null partials from page actions. CLK-677

Modified:
    click/trunk/click/framework/src/org/apache/click/ClickServlet.java

Modified: click/trunk/click/framework/src/org/apache/click/ClickServlet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ClickServlet.java?rev=949468&r1=949467&r2=949468&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickServlet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickServlet.java Sun May 30 04:13:26 2010
@@ -563,6 +563,7 @@ public class ClickServlet extends HttpSe
             String pageAction = context.getRequestParameter(Page.PAGE_ACTION);
             if (pageAction != null) {
                 continueProcessing = false;
+                // Returned partial could be null
                 partial = ClickUtils.invokeAction(page, pageAction);
             }
         }
@@ -751,6 +752,7 @@ public class ClickServlet extends HttpSe
      *
      * @param page page to render
      * @param context the request context
+     * @param partial the partial response object
      * @throws java.lang.Exception if error occurs
      */
     protected void performRender(Page page, Context context, Partial partial)
@@ -805,19 +807,24 @@ public class ClickServlet extends HttpSe
             partial.render(context);
 
         } else if (page.getPath() != null) {
-            String pagePath = page.getPath();
+            // Render template unless the request was a page action. This check
+            // guards against the scenario where the page action returns null
+            // instead of a partial instance
+            if (context.getRequestParameter(Page.PAGE_ACTION) == null) {
+                String pagePath = page.getPath();
+
+                // Check if request is a JSP page
+                if (pagePath.endsWith(".jsp") || configService.isJspPage(pagePath)) {
+                    // CLK-141. Set pagePath as the forward value.
+                    page.setForward(StringUtils.replace(pagePath, ".htm", ".jsp"));
+
+                    // Indicates the request is forwarded
+                    request.setAttribute(CLICK_FORWARD, CLICK_FORWARD);
+                    renderJSP(page);
 
-            // Check if request is a JSP page
-            if (pagePath.endsWith(".jsp") || configService.isJspPage(pagePath)) {
-                // CLK-141. Set pagePath as the forward value.
-                page.setForward(StringUtils.replace(pagePath, ".htm", ".jsp"));
-
-                // Indicates the request is forwarded
-                request.setAttribute(CLICK_FORWARD, CLICK_FORWARD);
-                renderJSP(page);
-
-            } else {
-                renderTemplate(page);
+                } else {
+                    renderTemplate(page);
+                }
             }
 
         } else {