KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > shared > JenaException


1 /*
2  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

5  
6 package com.hp.hpl.jena.shared;
7  
8 import java.io.*;
9
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 JavaDoc {
17
18     /**
19      * Constructor for JenaException.
20      * @param message
21      */

22     public JenaException( String JavaDoc message ) {
23         super(message);
24     }
25     
26     public JenaException()
27         { super(); }
28         
29     private Throwable JavaDoc cause;
30     /* Java 1.3, 1.4 compatibility.
31      * Support getCause() and initCause()
32      */

33     public Throwable JavaDoc getCause() {
34         return cause;
35     }
36
37     /**
38      * Java 1.4 bits ....
39      * Constructor for JenaException.
40      * @param cause
41      * */

42     public JenaException( Throwable JavaDoc cause )
43         { this( "rethrew: " + cause.toString(), cause ); }
44     
45     public JenaException( String JavaDoc message, Throwable JavaDoc cause )
46         { super( message ); this.cause = cause; }
47     
48     /*
49         These are so that the printout of a nested exception reveals where
50         the originating exception came from ... essential when debugging.
51     */

52     
53     public void printStackTrace( PrintStream s )
54         {
55         if (cause != null) cause.printStackTrace( s );
56         super.printStackTrace( s );
57         }
58         
59     public void printStackTrace( PrintWriter w )
60         {
61         if (cause != null) cause.printStackTrace( w );
62         super.printStackTrace( w );
63         }
64
65 }
66 /*
67  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
68  * All rights reserved.
69  *
70  * Redistribution and use in source and binary forms, with or without
71  * modification, are permitted provided that the following conditions
72  * are met:
73  * 1. Redistributions of source code must retain the above copyright
74  * notice, this list of conditions and the following disclaimer.
75  * 2. Redistributions in binary form must reproduce the above copyright
76  * notice, this list of conditions and the following disclaimer in the
77  * documentation and/or other materials provided with the distribution.
78  * 3. The name of the author may not be used to endorse or promote products
79  * derived from this software without specific prior written permission.
80  *
81  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
82  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
83  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
84  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
85  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
86  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
87  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
88  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
89  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
90  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
91  */
Popular Tags