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 2007/01/28 18:28:37 UTC
svn commit: r500843 - in /tomcat/tc6.0.x/trunk/java:
javax/servlet/jsp/JspException.java
org/apache/catalina/core/StandardWrapper.java
org/apache/catalina/valves/ErrorReportValve.java
Author: markt
Date: Sun Jan 28 09:28:36 2007
New Revision: 500843
URL: http://svn.apache.org/viewvc?view=rev&rev=500843
Log:
Update JspException to align with the JSP 2.1 spec.
Update root cause finding to take advantage of being able to use getCause
Modified:
tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/JspException.java
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
Modified: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/JspException.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/JspException.java?view=diff&rev=500843&r1=500842&r2=500843
==============================================================================
--- tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/JspException.java (original)
+++ tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/JspException.java Sun Jan 28 09:28:36 2007
@@ -48,55 +48,51 @@
/**
- * Constructs a new JSP exception when the JSP
- * needs to throw an exception and include a message
- * about the "root cause" exception that interfered with its
- * normal operation, including a description message.
- *
+ * Constructs a new <code>JSPException</code> with the specified detail
+ * message and cause. The cause is saved for later retrieval by the
+ * <code>java.lang.Throwable.getCause()</code> and {@link #getRootCause()}
+ * methods.
+ *
+ * @see <code>java.lang.Exception.Exception(String, Throwable)</code>
*
* @param message a <code>String</code> containing the text of the
* exception message
*
- * @param rootCause the <code>Throwable</code> exception that
- * interfered with the servlet's normal operation,
- * making this servlet exception necessary
+ * @param cause the <code>Throwable</code> exception that
+ * interfered with the JSP's normal operation,
+ * making this JSP exception necessary
*/
- public JspException(String message, Throwable rootCause) {
- super(message);
- this.rootCause = rootCause;
+ public JspException(String message, Throwable cause) {
+ super(message, cause);
}
/**
- * Constructs a new JSP exception when the JSP
- * needs to throw an exception and include a message
- * about the "root cause" exception that interfered with its
- * normal operation. The exception's message is based on the localized
- * message of the underlying exception.
- *
- * <p>This method calls the <code>getLocalizedMessage</code> method
- * on the <code>Throwable</code> exception to get a localized exception
- * message. When subclassing <code>JspException</code>,
- * this method can be overridden to create an exception message
- * designed for a specific locale.
+ * Constructs a new <code>JSPException</code> with the specified cause.
+ * The cause is saved for later retrieval by the
+ * <code>java.lang.Throwable.getCause()</code> and {@link #getRootCause()}
+ * methods.
+ *
+ * @see <code>java.lang.Exception.Exception(Throwable)</code>
*
- * @param rootCause the <code>Throwable</code> exception that
+ * @param cause the <code>Throwable</code> exception that
* interfered with the JSP's normal operation, making
* the JSP exception necessary
*/
- public JspException(Throwable rootCause) {
- super(rootCause.getLocalizedMessage());
- this.rootCause = rootCause;
+ public JspException(Throwable cause) {
+ super(cause);
}
/**
+ * @deprecated As of JSP 2.1, replaced by
+ * <code>java.lang.Throwable.getCause()</code>
+ *
* Returns the exception that caused this JSP exception.
*
* @return the <code>Throwable</code> that caused this JSP exception
- *
*/
public Throwable getRootCause() {
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java?view=diff&rev=500843&r1=500842&r2=500843
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java Sun Jan 28 09:28:36 2007
@@ -62,7 +62,6 @@
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.InstanceSupport;
-import org.apache.tomcat.util.IntrospectionUtils;
import org.apache.tomcat.util.log.SystemLogHandler;
import org.apache.tomcat.util.modeler.Registry;
@@ -295,18 +294,6 @@
protected static Properties restrictedServlets = null;
- private static Class jspExceptionClazz;
-
- static {
- try {
- jspExceptionClazz = Class.forName("javax.servlet.jsp.JspException");
- } catch (ClassNotFoundException e) {
- // Expected if jsp-api not on classpath, eg when embedding
- jspExceptionClazz = null;
- }
- }
-
-
// ------------------------------------------------------------- Properties
@@ -709,11 +696,7 @@
return theException;
}
- if (jspExceptionClazz!=null &&
- jspExceptionClazz.isAssignableFrom(theRootCause.getClass())) {
- deeperRootCause = (Throwable)IntrospectionUtils.getProperty(
- theRootCause, "rootCause");
- } else if (theRootCause instanceof SQLException) {
+ if (theRootCause instanceof SQLException) {
deeperRootCause = ((SQLException) theRootCause).getNextException();
}
if (deeperRootCause == null) {
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java?view=diff&rev=500843&r1=500842&r2=500843
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java Sun Jan 28 09:28:36 2007
@@ -34,7 +34,6 @@
import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.ServerInfo;
import org.apache.catalina.util.StringManager;
-import org.apache.tomcat.util.IntrospectionUtils;
/**
* <p>Implementation of a Valve that outputs HTML error pages.</p>
@@ -73,18 +72,6 @@
StringManager.getManager(Constants.Package);
- private static Class jspExceptionClazz;
-
- static {
- try {
- jspExceptionClazz = Class.forName("javax.servlet.jsp.JspException");
- } catch (ClassNotFoundException e) {
- // Expected if jsp-api not on classpath, eg when embedding
- jspExceptionClazz = null;
- }
- }
-
-
// ------------------------------------------------------------- Properties
@@ -241,12 +228,7 @@
sb.append("</pre></p>");
// In case root cause is somehow heavily nested
try {
- if (jspExceptionClazz!=null &&
- jspExceptionClazz.isAssignableFrom(
- rootCause.getClass())) {
- nestedRootCause = (Throwable)IntrospectionUtils.
- getProperty(rootCause, "rootCause");
- } else if (rootCause instanceof SQLException) {
+ if (rootCause instanceof SQLException) {
nestedRootCause = ((SQLException) rootCause).
getNextException();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org