KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbunit > DatabaseUnitRuntimeException


1 /*
2  *
3  * The DbUnit Database Testing Framework
4  * Copyright (C)2002-2004, DbUnit.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */

21
22 package org.dbunit;
23
24 import java.io.PrintStream JavaDoc;
25 import java.io.PrintWriter JavaDoc;
26
27 /**
28  * @author Manuel Laflamme
29  * @version $Revision: 1.8 $
30  */

31 public class DatabaseUnitRuntimeException extends RuntimeException JavaDoc
32 {
33     private final Throwable JavaDoc _e;
34
35     /**
36      * Constructs an <code>DatabaseUnitRuntimeException</code> with no specified
37      * detail message and no encapsulated exception.
38      */

39     public DatabaseUnitRuntimeException()
40     {
41         super();
42         _e = null;
43     }
44
45     /**
46      * Constructs an <code>DatabaseUnitRuntimeException</code> with the specified
47      * detail message and no encapsulated exception.
48      */

49     public DatabaseUnitRuntimeException(String JavaDoc msg)
50     {
51         super(msg);
52         _e = null;
53     }
54
55     /**
56      * Constructs an <code>DatabaseUnitRuntimeException</code> with the specified
57      * detail message and encapsulated exception.
58      */

59     public DatabaseUnitRuntimeException(String JavaDoc msg, Throwable JavaDoc e)
60     {
61         super(msg);
62         _e = e;
63     }
64
65     /**
66      * Constructs an <code>DatabaseUnitRuntimeException</code> with the encapsulated
67      * exception and use its message as detail message.
68      */

69     public DatabaseUnitRuntimeException(Throwable JavaDoc e)
70     {
71         super(e.toString());
72         _e = e;
73     }
74
75     /**
76      * Returns the encapsuled exception or <code>null</code> if none.
77      */

78     public Throwable JavaDoc getException()
79     {
80         return _e;
81     }
82
83     //////////////////////////////////////////////////////////////////////
84
// Exception class
85

86     /**
87      *
88      */

89     public void printStackTrace()
90     {
91         super.printStackTrace();
92         if (_e != null)
93             _e.printStackTrace();
94     }
95
96     /**
97      *
98      */

99     public void printStackTrace(PrintStream JavaDoc s)
100     {
101         super.printStackTrace(s);
102         if (_e != null)
103             _e.printStackTrace(s);
104     }
105
106     /**
107      *
108      */

109     public void printStackTrace(PrintWriter JavaDoc s)
110     {
111         super.printStackTrace(s);
112         if (_e != null)
113             _e.printStackTrace(s);
114     }
115 }
116
117
118
119
120
Popular Tags