/*
 * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
 * [See end of file]
 */
 
package com.hp.hpl.jena.shared;
 
import java.io.*;

/**
 * This should be a superclass of most exceptions
 * arising from Jena code.
 * @author jjc
 *
 */
public class JenaException extends RuntimeException {

	/**
	 * Constructor for JenaException.
	 * @param message
	 */
	public JenaException( String message ) {
		super(message);
	}
    
    public JenaException()
        { super(); }
        
    private Throwable cause;
    /* Java 1.3, 1.4 compatibility.
     * Support getCause() and initCause()
     */
    @Override
    public Throwable getCause() {
        return cause;
    }

	/**
	 * Java 1.4 bits ....
     * Constructor for JenaException.
	 * @param cause
	 * */
	public JenaException( Throwable cause )
		{ this( "rethrew: " + cause.toString(), cause ); }
    
    public JenaException( String message, Throwable cause )
        { super( message ); this.cause = cause; }
    
    /*
        These are so that the printout of a nested exception reveals where
        the originating exception came from ... essential when debugging. 
    */
    
    @Override
    public void printStackTrace( PrintStream s )
        {
        if (cause != null) cause.printStackTrace( s );
        super.printStackTrace( s );
        }
        
    @Override
    public void printStackTrace( PrintWriter w )
        {
        if (cause != null) cause.printStackTrace( w );
        super.printStackTrace( w );
        }

}
/*
 *  (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
 *  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
@@ -159,27 +159,8 @@
 ;%0A %0A
-import java.io.*;%0A%0A
 /**%0A
@@ -197,13 +197,8 @@
  of 
-most 
 exce
@@ -203,19 +203,16 @@
 ceptions
-%0A *
  arising
@@ -232,26 +232,8 @@
 de.%0A
- * @author jjc%0A *%0A
  */%0A
@@ -288,142 +288,10 @@
 ion 
+%0A
 %7B
-%0A%0A%09/**%0A%09 * Constructor for JenaException.%0A%09 * @param message%0A%09 */%0A%09public JenaException( String message ) %7B%0A%09%09super(message);%0A%09%7D%0A    
 %0A   
@@ -313,25 +313,24 @@
 eption()
-%0A
         
 %7B super(
@@ -325,29 +325,17 @@
     
-%7B super(); %7D%0A
+ 
         
 %0A   
@@ -334,290 +334,118 @@
     
-%0A
+ 
     
-private Throwable cause;%0A    /* Java 1.3, 1.4 compatibility.%0A     * Support getCause() and initCause()%0A     */%0A    @Override%0A    public Throwable getCause() %7B%0A        return cause;%0A    %7D%0A%0A%09/**%0A%09 * Java 1.4 bits ....%0A     * Constructor for JenaException.%0A%09 * @param cause%0A%09 * */
+               %7B super(); %7D%0A%09public JenaException(String message)                     %7B super(message); %7D
 %0A%09pu
@@ -463,17 +463,16 @@
 ception(
- 
 Throwabl
@@ -482,69 +482,48 @@
 ause
- )%0A%09%09%7B this( %22rethrew: %22 + cause.toString(), 
+)                    %7B super(
 cause
- 
 )
+ 
 ; %7D%0A
-    %0A
     
@@ -543,17 +543,16 @@
 ception(
- 
 String m
@@ -580,25 +580,20 @@
 se )
-%0A 
     
-   
 %7B super(
  mes
@@ -592,573 +592,27 @@
 per(
- 
 message
- ); this.cause = cause; %7D%0A    %0A    /*%0A        These are so that the printout of a nested exception reveals where%0A        the originating exception came from ... essential when debugging. %0A    */%0A    %0A    @Override%0A    public void printStackTrace( PrintStream s )%0A        %7B%0A        if (cause != null) cause.printStackTrace( s );%0A        super.printStackTrace( s );%0A        %7D%0A        %0A    @Override%0A    public void printStackTrace( PrintWriter w )%0A        %7B%0A        if (cause != null) cause.printStackTrace( w );%0A        super.printStackTrace( w );%0A        %7D%0A
+, cause) ; %7D
 %0A%7D%0A/

Remove handling of old Java with no "cause" support in exceptions.