yoavs 2004/09/20 10:58:26
Modified: webapps/docs changelog.xml
jasper2/src/share/org/apache/jasper/runtime
PageContextImpl.java
Log:
Bugzilla 31171: wrap to avoid ClassCastException if necessary.
Revision Changes Path
1.111 +5 -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.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- changelog.xml 20 Sep 2004 17:00:03 -0000 1.110
+++ changelog.xml 20 Sep 2004 17:58:26 -0000 1.111
@@ -57,6 +57,11 @@
</subsection>
<subsection name="Jasper">
+ <changelog>
+ <fix>
+ <bug>31171</bug>: Wrap to avoid ClassCastException in PageContextImpl.
(yoavs)
+ </fix>
+ </changelog>
</subsection>
<subsection name="Cluster">
1.61 +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.61
diff -u -r1.60 -r1.61
--- PageContextImpl.java 13 Apr 2004 22:55:50 -0000 1.60
+++ PageContextImpl.java 20 Sep 2004 17:58:26 -0000 1.61
@@ -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]