]> sjero.net Git - linphone/blob - p2pproxy/dependencies-src/jxse-src-2.5/impl/src/net/jxta/impl/xindice/util/XindiceRuntimeException.java
cdddff9ccf85b7eeaa993ab87782985c14711f3d
[linphone] / p2pproxy / dependencies-src / jxse-src-2.5 / impl / src / net / jxta / impl / xindice / util / XindiceRuntimeException.java
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * CVS $Id$
17  * CVS XindiceRuntimeException.java,v 1.5 2004/02/08 02:59:39 vgritsenko Exp $
18  */
19
20 package net.jxta.impl.xindice.util;
21
22
23 import java.io.PrintStream;
24 import java.io.PrintWriter;
25
26
27 /**
28  * A XindiceRuntimeException is the base class for all Xindice related RuntimeExceptions.
29  *
30  * @version CVS $Revision$, $Date$
31  */
32 public class XindiceRuntimeException extends RuntimeException {
33     protected Throwable cause;
34
35     public XindiceRuntimeException() {}
36
37     public XindiceRuntimeException(String message) {
38         super(message);
39     }
40
41     public XindiceRuntimeException(Throwable cause) {
42         super();
43         this.cause = cause;
44     }
45
46     public XindiceRuntimeException(String message, Throwable cause) {
47         super(message);
48         this.cause = cause;
49     }
50
51     @Override
52     public void printStackTrace() {
53         printStackTrace(System.err);
54     }
55
56     @Override
57     public void printStackTrace(PrintStream s) {
58         super.printStackTrace(s);
59         if (this.cause != null) {
60             s.print("Caused by: ");
61             this.cause.printStackTrace(s);
62         }
63     }
64
65     @Override
66     public void printStackTrace(PrintWriter s) {
67         super.printStackTrace(s);
68         if (this.cause != null) {
69             s.print("Caused by: ");
70             this.cause.printStackTrace(s);
71         }
72     }
73
74     @Override
75     public Throwable getCause() {
76         return cause;
77     }
78 }