click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From med...@apache.org
Subject svn commit: r923560 - in /click/trunk/click/framework/src/org/apache/click: ClickServlet.java service/TemplateException.java util/ErrorReport.java
Date Tue, 16 Mar 2010 03:00:38 GMT
Author: medgar
Date: Tue Mar 16 03:00:37 2010
New Revision: 923560

URL: http://svn.apache.org/viewvc?rev=923560&view=rev
Log:
TemplateException handling

Modified:
    click/trunk/click/framework/src/org/apache/click/ClickServlet.java
    click/trunk/click/framework/src/org/apache/click/service/TemplateException.java
    click/trunk/click/framework/src/org/apache/click/util/ErrorReport.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=923560&r1=923559&r2=923560&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickServlet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickServlet.java Tue Mar 16 03:00:37
2010
@@ -444,7 +444,13 @@ public class ClickServlet extends HttpSe
         HttpServletResponse response, boolean isPost, Throwable exception,
         Class<? extends Page> pageClass) {
 
-        if (exception instanceof TemplateException == false) {
+        if (exception instanceof TemplateException) {
+            TemplateException te = (TemplateException) exception;
+            if (!te.isParseError()) {
+                logger.error("handleException: ", exception);
+            }
+
+        } else {
             logger.error("handleException: ", exception);
         }
 

Modified: click/trunk/click/framework/src/org/apache/click/service/TemplateException.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/service/TemplateException.java?rev=923560&r1=923559&r2=923560&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/service/TemplateException.java (original)
+++ click/trunk/click/framework/src/org/apache/click/service/TemplateException.java Tue Mar
16 03:00:37 2010
@@ -18,6 +18,9 @@
  */
 package org.apache.click.service;
 
+import org.apache.commons.lang.StringUtils;
+
+
 /**
  * Provides a template exception class for use by the template service. This is
  * used to wrap TemplateService exceptions.
@@ -95,6 +98,15 @@ public class TemplateException extends E
     }
 
     /**
+     * Return true if a template parsing error.
+     *
+     * @return true if a template parsing error
+     */
+    public boolean isParseError() {
+        return StringUtils.isNotBlank(getTemplateName());
+    }
+
+    /**
      * @see Object#toString()
      *
      * @return the string representation of this error

Modified: click/trunk/click/framework/src/org/apache/click/util/ErrorReport.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/ErrorReport.java?rev=923560&r1=923559&r2=923560&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/ErrorReport.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/ErrorReport.java Tue Mar 16 03:00:37
2010
@@ -28,7 +28,6 @@ import java.io.LineNumberReader;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Enumeration;
-import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle;
@@ -112,7 +111,7 @@ public class ErrorReport {
         this.servletContext = servletContext;
 
         if (error instanceof TemplateException
-            && ((TemplateException) error).getTemplateName() != null) {
+            && ((TemplateException) error).isParseError()) {
 
             TemplateException te = (TemplateException) error;
 
@@ -192,6 +191,7 @@ public class ErrorReport {
      *
      * @return a error HTML display string
      */
+    @SuppressWarnings("unchecked")
     public String toString() {
 
         if (isProductionMode()) {
@@ -642,9 +642,8 @@ public class ErrorReport {
      * @param buffer the string buffer to write out the values to
      */
     protected void writeMap(Map<String, Object> map, HtmlStringBuffer buffer) {
-        for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
-            Map.Entry entry = (Map.Entry) i.next();
-            String key = entry.getKey().toString();
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
+            String key = entry.getKey();
             Object value = entry.getValue();
 
             buffer.append(key);



Mime
View raw message