2011/08/05 - Jakarta Cactus has been retired.

For more information, please explore the Attic.

Clover coverage report - Cactus 1.8dev for J2EE API 1.3
Coverage timestamp: Sun Mar 26 2006 18:50:18 BRT
file stats: LOC: 127   Methods: 6
NCLOC: 49   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ServletExceptionWrapper.java 0% 0% 0% 0%
coverage
 1   
 /* 
 2   
  * ========================================================================
 3   
  * 
 4   
  * Copyright 2001-2003 The Apache Software Foundation.
 5   
  *
 6   
  * Licensed under the Apache License, Version 2.0 (the "License");
 7   
  * you may not use this file except in compliance with the License.
 8   
  * You may obtain a copy of the License at
 9   
  * 
 10   
  *   http://www.apache.org/licenses/LICENSE-2.0
 11   
  * 
 12   
  * Unless required by applicable law or agreed to in writing, software
 13   
  * distributed under the License is distributed on an "AS IS" BASIS,
 14   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15   
  * See the License for the specific language governing permissions and
 16   
  * limitations under the License.
 17   
  * 
 18   
  * ========================================================================
 19   
  */
 20   
 package org.apache.cactus.internal.client;
 21   
 
 22   
 import java.io.PrintStream;
 23   
 import java.io.PrintWriter;
 24   
 
 25   
 /**
 26   
  * Wrapper around a <code>Throwable</code> object. Whenever an exception occurs
 27   
  * in a test case executed on the server side, the text of this exception
 28   
  * along with the stack trace as a String are sent back in the HTTP response.
 29   
  * This is because some exceptions are not serializable and because the stack
 30   
  * trace is implemented as a <code>transient</code> variable by the JDK so it
 31   
  * cannot be transported in the response. However, we need to send a real
 32   
  * exception object to JUnit so that the exception stack trace will be printed
 33   
  * in the JUnit console. This class does this by being a <code>Throwable</code>
 34   
  * and overloading the <code>printStackTrace()</code> methods to print a
 35   
  * text stack trace.
 36   
  *
 37   
  * @version $Id: ServletExceptionWrapper.java 238991 2004-05-22 11:34:50Z vmassol $
 38   
  */
 39   
 public class ServletExceptionWrapper extends Throwable
 40   
 {
 41   
     /**
 42   
      * The stack trace that was sent back from the servlet redirector as a
 43   
      * string.
 44   
      */
 45   
     private String stackTrace;
 46   
 
 47   
     /**
 48   
      * The class name of the exception that was raised on the server side.
 49   
      */
 50   
     private String className;
 51   
 
 52   
     /**
 53   
      * Standard throwable constructor.
 54   
      *
 55   
      * @param theMessage the exception message
 56   
      */
 57  0
     public ServletExceptionWrapper(String theMessage)
 58   
     {
 59  0
         super(theMessage);
 60   
     }
 61   
 
 62   
     /**
 63   
      * Standard throwable constructor.
 64   
      */
 65  0
     public ServletExceptionWrapper()
 66   
     {
 67  0
         super();
 68   
     }
 69   
 
 70   
     /**
 71   
      * The constructor to use to simulate a real exception.
 72   
      *
 73   
      * @param theMessage the server exception message
 74   
      * @param theClassName the server exception class name
 75   
      * @param theStackTrace the server exception stack trace
 76   
      */
 77  0
     public ServletExceptionWrapper(String theMessage, String theClassName, 
 78   
         String theStackTrace)
 79   
     {
 80  0
         super(theMessage);
 81  0
         this.className = theClassName;
 82  0
         this.stackTrace = theStackTrace;
 83   
     }
 84   
 
 85   
     /**
 86   
      * Simulates a printing of a stack trace by printing the string stack trace
 87   
      *
 88   
      * @param thePs the stream to which to output the stack trace
 89   
      */
 90  0
     public void printStackTrace(PrintStream thePs)
 91   
     {
 92  0
         if (this.stackTrace == null)
 93   
         {
 94  0
             thePs.print(getMessage());
 95   
         }
 96   
         else
 97   
         {
 98  0
             thePs.print(this.stackTrace);
 99   
         }
 100   
     }
 101   
 
 102   
     /**
 103   
      * Simulates a printing of a stack trace by printing the string stack trace
 104   
      *
 105   
      * @param thePw the writer to which to output the stack trace
 106   
      */
 107  0
     public void printStackTrace(PrintWriter thePw)
 108   
     {
 109  0
         if (this.stackTrace == null)
 110   
         {
 111  0
             thePw.print(getMessage());
 112   
         }
 113   
         else
 114   
         {
 115  0
             thePw.print(this.stackTrace);
 116   
         }
 117   
     }
 118   
 
 119   
     /**
 120   
      * @return the wrapped class name
 121   
      */
 122  0
     public String getWrappedClassName()
 123   
     {
 124  0
         return this.className;
 125   
     }
 126   
 }
 127