Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

CJDBCException.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Mathieu Peltier.
00022  * Contributor(s): _______________________.
00023  */
00024 
00025 package org.objectweb.cjdbc.common.exceptions;
00026 
00027 import java.io.PrintStream;
00028 import java.io.PrintWriter;
00029 import java.io.Serializable;
00030 
00031 /**
00032  * C-JDBC base exception.
00033  * 
00034  * @author <a href="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a>
00035  * @version 1.0
00036  */
00037 public class CJDBCException extends Exception implements Serializable
00038 {
00039   /** Optional exception cause */
00040   protected Throwable cause;
00041 
00042   /**
00043    * Creates a new <code>CJDBCException</code> instance.
00044    */
00045   public CJDBCException()
00046   {
00047   }
00048 
00049   /**
00050    * Creates a new <code>CJDBCException</code> instance.
00051    * 
00052    * @param message the error message
00053    */
00054   public CJDBCException(String message)
00055   {
00056     super(message);
00057   }
00058 
00059   /**
00060    * Creates a new <code>CJDBCException</code> instance.
00061    * 
00062    * @param cause the root cause
00063    */
00064   public CJDBCException(Throwable cause)
00065   {
00066     this.cause = cause;
00067   }
00068 
00069   /**
00070    * Creates a new <code>CJDBCException</code> instance.
00071    * 
00072    * @param message the error message
00073    * @param cause the root cause
00074    */
00075   public CJDBCException(String message, Throwable cause)
00076   {
00077     super(message);
00078     this.cause = cause;
00079   }
00080 
00081   /**
00082    * Gets the root cause of this exception.
00083    * 
00084    * @return a <code>Throwable</code> object
00085    */
00086   public Throwable getCause()
00087   {
00088     return cause;
00089   }
00090 
00091   /**
00092    * @see java.lang.Throwable#fillInStackTrace()
00093    */
00094   public synchronized Throwable fillInStackTrace()
00095   {
00096     if (cause != null)
00097     {
00098       return cause.fillInStackTrace();
00099     }
00100     else
00101     {
00102       return super.fillInStackTrace();
00103     }
00104   }
00105 
00106   /**
00107    * @see java.lang.Throwable#getStackTrace()
00108    */
00109   public StackTraceElement[] getStackTrace()
00110   {
00111     if (cause != null)
00112     {
00113       return cause.getStackTrace();
00114     }
00115     else
00116     {
00117       return super.getStackTrace();
00118     }
00119   }
00120 
00121   /**
00122    * @see java.lang.Throwable#getMessage()
00123    */
00124   public String getMessage()
00125   {
00126     if (cause != null)
00127     {
00128       return cause.getMessage();
00129     }
00130     else
00131     {
00132       return super.getMessage();
00133     }
00134   }
00135 
00136   /**
00137    * @see java.lang.Throwable#printStackTrace()
00138    */
00139   public void printStackTrace()
00140   {
00141     if (cause != null)
00142     {
00143       cause.printStackTrace();
00144     }
00145     else
00146     {
00147       super.printStackTrace();
00148     }
00149   }
00150 
00151   /**
00152    * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
00153    */
00154   public void printStackTrace(PrintStream arg0)
00155   {
00156     if (cause != null)
00157     {
00158       cause.printStackTrace(arg0);
00159     }
00160     else
00161     {
00162       super.printStackTrace(arg0);
00163     }
00164   }
00165 
00166   /**
00167    * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
00168    */
00169   public void printStackTrace(PrintWriter arg0)
00170   {
00171     if (cause != null)
00172     {
00173       cause.printStackTrace(arg0);
00174     }
00175     else
00176     {
00177       super.printStackTrace(arg0);
00178     }
00179   }
00180 
00181   /**
00182    * @see java.lang.Throwable#setStackTrace(java.lang.StackTraceElement[])
00183    */
00184   public void setStackTrace(StackTraceElement[] arg0)
00185   {
00186     if (cause != null)
00187     {
00188       cause.setStackTrace(arg0);
00189     }
00190     else
00191     {
00192       super.setStackTrace(arg0);
00193     }
00194   }
00195 
00196 }

Generated on Mon Apr 11 22:01:29 2005 for C-JDBC by  doxygen 1.3.9.1