tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1348762 - in /tomcat/trunk: java/org/apache/catalina/valves/ErrorReportValve.java test/org/apache/catalina/valves/TestErrorReportValve.java
Date Mon, 11 Jun 2012 09:24:53 GMT
Author: markt
Date: Mon Jun 11 09:24:53 2012
New Revision: 1348762

URL: http://svn.apache.org/viewvc?rev=1348762&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53071
Stepping through the code, light dawns as to what the bug report was getting at.
Use the message from the Throwable for the error report if none was specified via sendError()

Modified:
    tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
    tomcat/trunk/test/org/apache/catalina/valves/TestErrorReportValve.java

Modified: tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java?rev=1348762&r1=1348761&r2=1348762&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java Mon Jun 11 09:24:53
2012
@@ -141,7 +141,11 @@ public class ErrorReportValve extends Va
 
         String message = RequestUtil.filter(response.getMessage());
         if (message == null) {
-            message = "";
+            if (throwable != null) {
+                message = RequestUtil.filter(throwable.getMessage());
+            } else {
+                message = "";
+            }
         }
 
         // Do nothing if there is no report for the specified status code

Modified: tomcat/trunk/test/org/apache/catalina/valves/TestErrorReportValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/valves/TestErrorReportValve.java?rev=1348762&r1=1348761&r2=1348762&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/valves/TestErrorReportValve.java (original)
+++ tomcat/trunk/test/org/apache/catalina/valves/TestErrorReportValve.java Mon Jun 11 09:24:53
2012
@@ -49,7 +49,8 @@ public class TestErrorReportValve extend
 
         ByteChunk res = getUrl("http://localhost:" + getPort());
 
-        Assert.assertTrue(res.toString().contains(ErrorServlet.ERROR_TEXT));
+        Assert.assertTrue(res.toString().contains("<p><b>message</b> <u>"
+
+                ErrorServlet.ERROR_TEXT + "</u></p>"));
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message