Author: markt Date: Tue Jun 22 09:00:15 2010 New Revision: 956822 URL: http://svn.apache.org/viewvc?rev=956822&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49196 Avoid NullPointerException in PageContext.getErrorData() if an error-handling JSP page is called directly.
Modified: tomcat/tc5.5.x/trunk/STATUS.txt tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml tomcat/tc5.5.x/trunk/servletapi/jsr152/src/share/javax/servlet/jsp/PageContext.java Modified: tomcat/tc5.5.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=956822&r1=956821&r2=956822&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/STATUS.txt (original) +++ tomcat/tc5.5.x/trunk/STATUS.txt Tue Jun 22 09:00:15 2010 @@ -54,14 +54,6 @@ PATCHES PROPOSED TO BACKPORT: http://svn.apache.org/viewvc?view=revision&revision=749019 -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49196 - Avoid NullPointerException in PageContext.getErrorData() if an - error-handling JSP page is called directly. - It is backport of r948057. - https://issues.apache.org/bugzilla/attachment.cgi?id=25534 - +1: kkolinko, markt, kfujino - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48990#c11 Do not omit exe and dll files in release builds built on Unixes, to align them with the official ones built on Windows. Modified: tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml?rev=956822&r1=956821&r2=956822&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml (original) +++ tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml Tue Jun 22 09:00:15 2010 @@ -133,6 +133,11 @@ security manager if the first access is to a JSP that uses a FunctionMapper. (markt/kkolinko) </fix> + <fix> + <bug>49196</bug>: Avoid NullPointerException in + PageContext.getErrorData() if an error-handling JSP page is called + directly. (kkolinko) + </fix> </changelog> </subsection> <subsection name="Cluster"> Modified: tomcat/tc5.5.x/trunk/servletapi/jsr152/src/share/javax/servlet/jsp/PageContext.java URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/servletapi/jsr152/src/share/javax/servlet/jsp/PageContext.java?rev=956822&r1=956821&r2=956822&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/servletapi/jsr152/src/share/javax/servlet/jsp/PageContext.java (original) +++ tomcat/tc5.5.x/trunk/servletapi/jsr152/src/share/javax/servlet/jsp/PageContext.java Tue Jun 22 09:00:15 2010 @@ -512,10 +512,18 @@ abstract public class PageContext * @since 2.0 */ public ErrorData getErrorData() { + int status = 0; + + Integer status_code = (Integer)getRequest().getAttribute( + "javax.servlet.error.status_code"); + // Avoid NPE if attribute is not set + if (status_code != null) { + status = status_code.intValue(); + } + return new ErrorData( (Throwable)getRequest().getAttribute( "javax.servlet.error.exception" ), - ((Integer)getRequest().getAttribute( - "javax.servlet.error.status_code" )).intValue(), + status, (String)getRequest().getAttribute( "javax.servlet.error.request_uri" ), (String)getRequest().getAttribute( "javax.servlet.error.servlet_name" ) ); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org