cvs commit: jakarta-tomcat-4.0/tester/src/tester/org/apache/tester ErrorPage04.java

2004-01-05 Thread larryi
larryi  2004/01/05 18:21:29

  Modified:tester/src/tester/org/apache/tester ErrorPage04.java
  Log:
  Port some changes to tester from Tomcat 5. These changes currently leave
  just two failures.
  
  1. The access to "/examples/.." fails the first time tester is run since starting
  Tomcat by returning 200.  Subsequent runs of tester return the expected
  302.
  
  2. For the JspDoc1.jsp test, Jasper condenses "" to  within
   tags, instead of preserving whitespace.  Don't know how easy
  it would be to port changes from Jasper HEAD.  This commit includes
  updating the JspDoc1.txt golden file to that found in the Tomcat 5 tester.
  I believe this should be the expected result for JSP 1.2 too.
  
  Revision  ChangesPath
  1.4   +7 -18 
jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/ErrorPage04.java
  
  Index: ErrorPage04.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/ErrorPage04.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ErrorPage04.java  26 Apr 2001 16:39:13 -  1.3
  +++ ErrorPage04.java  6 Jan 2004 02:21:29 -   1.4
  @@ -82,33 +82,22 @@
   
   // Accumulate all the reasons this request might fail
   ServletException exception = null;
  -Throwable rootCause = null;
   StringBuffer sb = new StringBuffer();
   Object value = null;
   
   value = request.getAttribute("javax.servlet.error.exception");
   if (value == null)
   sb.append(" exception is missing/");
  -else if (!(value instanceof javax.servlet.ServletException)) {
  +else if (!(value instanceof org.apache.tester.TesterException)) {
   sb.append(" exception class is ");
   sb.append(value.getClass().getName());
   sb.append("/");
   } else {
  -exception = (ServletException) value;
  -rootCause = exception.getRootCause();
  -if (rootCause == null) {
  -sb.append(" rootCause is missing/");
  -} else if (!(rootCause instanceof TesterException)) {
  -sb.append(" rootCause is ");
  -sb.append(rootCause.getClass().getName());
  +TesterException te = (TesterException) value;
  +if (!"ErrorPage03 Threw Exception".equals(te.getMessage())) {
  +sb.append(" exception message is ");
  +sb.append(te.getMessage());
   sb.append("/");
  -} else {
  -TesterException te = (TesterException) rootCause;
  -if (!"ErrorPage03 Threw Exception".equals(te.getMessage())) {
  -sb.append(" exception message is ");
  -sb.append(te.getMessage());
  -sb.append("/");
  -}
   }
   }
   
  @@ -121,7 +110,7 @@
   sb.append("/");
   } else {
   Class clazz = (Class) value;
  -if (!"javax.servlet.ServletException".equals(clazz.getName())) {
  +if (!"org.apache.tester.TesterException".equals(clazz.getName())) {
   sb.append(" exception_type class is ");
   sb.append(clazz.getName());
   sb.append("/");
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-4.0/tester/src/tester/org/apache/tester ErrorPage04.java ErrorPage06.java

2001-04-26 Thread craigmcc

craigmcc01/04/26 09:39:14

  Modified:tester/src/tester/org/apache/tester ErrorPage04.java
ErrorPage06.java
  Log:
  [PFD2-9.9] Revise the error page propogation tests to reflect the fact that
  the actual exception that was thrown is forwarded to the error pages.
  Previously, if the actual exception was a ServletException with a rootCause
  embedded, the rootCause exception was unwrapped and its information was
  forwarded.
  
  Revision  ChangesPath
  1.3   +19 -7 
jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/ErrorPage04.java
  
  Index: ErrorPage04.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/ErrorPage04.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ErrorPage04.java  2001/03/18 06:12:55 1.2
  +++ ErrorPage04.java  2001/04/26 16:39:13 1.3
  @@ -67,7 +67,7 @@
* the ErrorPage01 servlet returns the appropriate exception.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2001/03/18 06:12:55 $
  + * @version $Revision: 1.3 $ $Date: 2001/04/26 16:39:13 $
*/
   
   public class ErrorPage04 extends HttpServlet {
  @@ -81,22 +81,34 @@
   PrintWriter writer = response.getWriter();
   
   // Accumulate all the reasons this request might fail
  +ServletException exception = null;
  +Throwable rootCause = null;
   StringBuffer sb = new StringBuffer();
   Object value = null;
   
   value = request.getAttribute("javax.servlet.error.exception");
   if (value == null)
   sb.append(" exception is missing/");
  -else if (!(value instanceof TesterException)) {
  +else if (!(value instanceof javax.servlet.ServletException)) {
   sb.append(" exception class is ");
   sb.append(value.getClass().getName());
   sb.append("/");
   } else {
  -TesterException te = (TesterException) value;
  -if (!"ErrorPage03 Threw Exception".equals(te.getMessage())) {
  -sb.append(" exception message is ");
  -sb.append(te.getMessage());
  +exception = (ServletException) value;
  +rootCause = exception.getRootCause();
  +if (rootCause == null) {
  +sb.append(" rootCause is missing/");
  +} else if (!(rootCause instanceof TesterException)) {
  +sb.append(" rootCause is ");
  +sb.append(rootCause.getClass().getName());
   sb.append("/");
  +} else {
  +TesterException te = (TesterException) rootCause;
  +if (!"ErrorPage03 Threw Exception".equals(te.getMessage())) {
  +sb.append(" exception message is ");
  +sb.append(te.getMessage());
  +sb.append("/");
  +}
   }
   }
   
  @@ -109,7 +121,7 @@
   sb.append("/");
   } else {
   Class clazz = (Class) value;
  -if (!"org.apache.tester.TesterException".equals(clazz.getName())) {
  +if (!"javax.servlet.ServletException".equals(clazz.getName())) {
   sb.append(" exception_type class is ");
   sb.append(clazz.getName());
   sb.append("/");
  
  
  
  1.2   +24 -11
jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/ErrorPage06.java
  
  Index: ErrorPage06.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/ErrorPage06.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ErrorPage06.java  2001/04/14 00:03:17 1.1
  +++ ErrorPage06.java  2001/04/26 16:39:13 1.2
  @@ -67,7 +67,7 @@
* the ErrorPage05 servlet returns the appropriate exception.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2001/04/14 00:03:17 $
  + * @version $Revision: 1.2 $ $Date: 2001/04/26 16:39:13 $
*/
   
   public class ErrorPage06 extends HttpServlet {
  @@ -81,18 +81,38 @@
   PrintWriter writer = response.getWriter();
   
   // Accumulate all the reasons this request might fail
  +ServletException exception = null;
  +Throwable rootCause = null;
   StringBuffer sb = new StringBuffer();
   Object value = null;
   
   value = request.getAttribute("javax.servlet.error.exception");
  -if (value == null)
  +if (value == null) {
   sb.append(" exception is missing/");
  -else if (!(value instanceof java.lang.ArithmeticException)) {
  +} else if (!(value instanceof javax.servlet.ServletException)) {
   sb.append(" exception class is ");
   sb.appe