2012/6/11 <[email protected]>:
> 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 = "";
> + }
throwable.getMessage() can return null, e.g. it usually happens with
a NullPointerException
So it'd be better to do
if (throwable != null) {
message = RequestUtil.filter(throwable.getMessage());
}
if (message == null) {
message = "";
}
Alternatively, maybe String.valueOf(throwable.getMessage()) to convert
null to "null". I cannot say what is better without a bit of
experimenting, but using "" as the value is what we had before.
> }
>
> // Do nothing if there is no report for the specified status code
>
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]