You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/05/25 16:20:58 UTC
svn commit: r948057 - /tomcat/trunk/java/javax/servlet/jsp/PageContext.java
Author: markt
Date: Tue May 25 14:20:58 2010
New Revision: 948057
URL: http://svn.apache.org/viewvc?rev=948057&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49196
Avoid NPE on PageContext.getErrorData()
Modified:
tomcat/trunk/java/javax/servlet/jsp/PageContext.java
Modified: tomcat/trunk/java/javax/servlet/jsp/PageContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/PageContext.java?rev=948057&r1=948056&r2=948057&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/jsp/PageContext.java (original)
+++ tomcat/trunk/java/javax/servlet/jsp/PageContext.java Tue May 25 14:20:58 2010
@@ -513,10 +513,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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org