01: /*
02: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * [See end of file]
04: */
05:
06: package com.hp.hpl.jena.shared;
07:
08: import java.io.*;
09:
10: /**
11: * This should be a superclass of most exceptions
12: * arising from Jena code.
13: * @author jjc
14: *
15: */
16: public class JenaException extends RuntimeException {
17:
18: /**
19: * Constructor for JenaException.
20: * @param message
21: */
22: public JenaException(String message) {
23: super (message);
24: }
25:
26: public JenaException() {
27: super ();
28: }
29:
30: private Throwable cause;
31:
32: /* Java 1.3, 1.4 compatibility.
33: * Support getCause() and initCause()
34: */
35: public Throwable getCause() {
36: return cause;
37: }
38:
39: /**
40: * Java 1.4 bits ....
41: * Constructor for JenaException.
42: * @param cause
43: * */
44: public JenaException(Throwable cause) {
45: this ("rethrew: " + cause.toString(), cause);
46: }
47:
48: public JenaException(String message, Throwable cause) {
49: super (message);
50: this .cause = cause;
51: }
52:
53: /*
54: These are so that the printout of a nested exception reveals where
55: the originating exception came from ... essential when debugging.
56: */
57:
58: public void printStackTrace(PrintStream s) {
59: if (cause != null)
60: cause.printStackTrace(s);
61: super .printStackTrace(s);
62: }
63:
64: public void printStackTrace(PrintWriter w) {
65: if (cause != null)
66: cause.printStackTrace(w);
67: super .printStackTrace(w);
68: }
69:
70: }
71: /*
72: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
73: * All rights reserved.
74: *
75: * Redistribution and use in source and binary forms, with or without
76: * modification, are permitted provided that the following conditions
77: * are met:
78: * 1. Redistributions of source code must retain the above copyright
79: * notice, this list of conditions and the following disclaimer.
80: * 2. Redistributions in binary form must reproduce the above copyright
81: * notice, this list of conditions and the following disclaimer in the
82: * documentation and/or other materials provided with the distribution.
83: * 3. The name of the author may not be used to endorse or promote products
84: * derived from this software without specific prior written permission.
85: *
86: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
87: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
88: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
89: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
90: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
91: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
92: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
93: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
94: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
95: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
96: */
|