|
|||||||||||||||||||
| 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 | |||||||||||||||
| ChainedRuntimeException.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 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.util;
|
|
| 21 |
|
|
| 22 |
import java.io.PrintStream;
|
|
| 23 |
import java.io.PrintWriter;
|
|
| 24 |
|
|
| 25 |
/**
|
|
| 26 |
* Represent an exception that should stop the running test. It is a runtime
|
|
| 27 |
* exception but it will be caught by JUnit so the application will not stop.
|
|
| 28 |
* The test will be reported as failed. It implements chaining.
|
|
| 29 |
*
|
|
| 30 |
* @version $Id: ChainedRuntimeException.java 238991 2004-05-22 11:34:50Z vmassol $
|
|
| 31 |
*/
|
|
| 32 |
public class ChainedRuntimeException extends RuntimeException |
|
| 33 |
{
|
|
| 34 |
/**
|
|
| 35 |
* Original exception which caused this exception.
|
|
| 36 |
*/
|
|
| 37 |
protected Throwable originalException;
|
|
| 38 |
|
|
| 39 |
/**
|
|
| 40 |
* Create a <code>ChainedRuntimeException</code> and set the exception
|
|
| 41 |
* error message.
|
|
| 42 |
*
|
|
| 43 |
* @param theMessage the message of the exception
|
|
| 44 |
*/
|
|
| 45 | 0 |
public ChainedRuntimeException(String theMessage)
|
| 46 |
{
|
|
| 47 | 0 |
this(theMessage, null); |
| 48 |
} |
|
| 49 |
|
|
| 50 |
/**
|
|
| 51 |
* Create a <code>ChainedRuntimeException</code>, set the exception error
|
|
| 52 |
* message along with the exception object that caused this exception.
|
|
| 53 |
*
|
|
| 54 |
* @param theMessage the detail of the error message
|
|
| 55 |
* @param theException the original exception
|
|
| 56 |
*/
|
|
| 57 | 0 |
public ChainedRuntimeException(String theMessage, Throwable theException)
|
| 58 |
{
|
|
| 59 | 0 |
super(theMessage);
|
| 60 | 0 |
this.originalException = theException;
|
| 61 |
} |
|
| 62 |
|
|
| 63 |
/**
|
|
| 64 |
* Create a <code>ChainedRuntimeException</code>, and set exception object
|
|
| 65 |
* that caused this exception. The message is set by default to be the one
|
|
| 66 |
* from the original exception.
|
|
| 67 |
*
|
|
| 68 |
* @param theException the original exception
|
|
| 69 |
*/
|
|
| 70 | 0 |
public ChainedRuntimeException(Throwable theException)
|
| 71 |
{
|
|
| 72 | 0 |
super(theException.getMessage());
|
| 73 | 0 |
this.originalException = theException;
|
| 74 |
} |
|
| 75 |
|
|
| 76 |
/**
|
|
| 77 |
* Print the full stack trace, including the original exception.
|
|
| 78 |
*/
|
|
| 79 | 0 |
public void printStackTrace() |
| 80 |
{
|
|
| 81 | 0 |
printStackTrace(System.err); |
| 82 |
} |
|
| 83 |
|
|
| 84 |
/**
|
|
| 85 |
* Print the full stack trace, including the original exception.
|
|
| 86 |
*
|
|
| 87 |
* @param thePs the byte stream in which to print the stack trace
|
|
| 88 |
*/
|
|
| 89 | 0 |
public void printStackTrace(PrintStream thePs) |
| 90 |
{
|
|
| 91 | 0 |
super.printStackTrace(thePs);
|
| 92 |
|
|
| 93 | 0 |
if (this.originalException != null) |
| 94 |
{
|
|
| 95 | 0 |
this.originalException.printStackTrace(thePs);
|
| 96 |
} |
|
| 97 |
} |
|
| 98 |
|
|
| 99 |
/**
|
|
| 100 |
* Print the full stack trace, including the original exception.
|
|
| 101 |
*
|
|
| 102 |
* @param thePw the character stream in which to print the stack trace
|
|
| 103 |
*/
|
|
| 104 | 0 |
public void printStackTrace(PrintWriter thePw) |
| 105 |
{
|
|
| 106 | 0 |
super.printStackTrace(thePw);
|
| 107 |
|
|
| 108 | 0 |
if (this.originalException != null) |
| 109 |
{
|
|
| 110 | 0 |
this.originalException.printStackTrace(thePw);
|
| 111 |
} |
|
| 112 |
} |
|
| 113 |
} |
|
| 114 |
|
|
||||||||||