yoavs 2004/09/20 11:07:22
Modified: webapps/docs Tag: TOMCAT_5_0 changelog.xml
jasper2/src/share/org/apache/jasper/runtime Tag: TOMCAT_5_0
PageContextImpl.java
Log:
Bugzilla 31171: wrap to avoid ClassCastException if necessary.
Revision Changes Path
No revision
No revision
1.70.2.37 +3 -0 jakarta-tomcat-catalina/webapps/docs/changelog.xml
Index: changelog.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
retrieving revision 1.70.2.36
retrieving revision 1.70.2.37
diff -u -r1.70.2.36 -r1.70.2.37
--- changelog.xml 20 Sep 2004 16:39:28 -0000 1.70.2.36
+++ changelog.xml 20 Sep 2004 18:07:21 -0000 1.70.2.37
@@ -99,6 +99,9 @@
<fix>
<bug>30984</bug>: Added compilerTargetVM option to Jasper. (yoavs)
</fix>
+ <fix>
+ <bug>31171</bug>: Wrap to avoid ClassCastException in PageContextImpl.
(yoavs)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
No revision
No revision
1.60.2.1 +21 -1
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java
Index: PageContextImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
retrieving revision 1.60
retrieving revision 1.60.2.1
diff -u -r1.60 -r1.60.2.1
--- PageContextImpl.java 13 Apr 2004 22:55:50 -0000 1.60
+++ PageContextImpl.java 20 Sep 2004 18:07:22 -0000 1.60.2.1
@@ -557,7 +557,27 @@
}
public ServletRequest getRequest() { return request; }
public ServletResponse getResponse() { return response; }
- public Exception getException() { return
(Exception)request.getAttribute(EXCEPTION); }
+
+ /**
+ * Returns the exception associated with this page
+ * context, if any.
+ * <p/>
+ * Added wrapping for Throwables to avoid ClassCaseException:
+ * see Bugzilla 31171 for details.
+ *
+ * @return The Exception associated with this page context, if any.
+ */
+ public Exception getException() {
+ Throwable exc = (Throwable) request.getAttribute(EXCEPTION);
+
+ // Only wrap if needed
+ if((exc != null) && (! (exc instanceof Exception))) {
+ exc = new JspException(exc);
+ }
+
+ return (Exception) exc;
+ }
+
public Object getPage() { return servlet; }
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]