www.pudn.com > town-1[1].0.4.rar > ConnectionException.java


package com.workingdogs.town; 
 
import java.io.*; 
import java.sql.*; 
 
/* 
Town, a Java JDBC abstraction layer 
Copyright (C) 1999  Serge Knystautas, Jon Stevens 
 
This library is free software; you can redistribute it and/or 
modify it under the terms of the GNU Library General Public 
License as published by the Free Software Foundation; either 
version 2 of the License, or (at your option) any later version. 
 
This library is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
Library General Public License for more details. 
 
You should have received a copy of the GNU Library General Public 
License along with this library; if not, write to the 
Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
Boston, MA  02111-1307, USA. 
*/ 
/** 
This wraps a SQLException.  This extends IOException so that servlets can 
use the ConnectionException as if it was a SQLException, but are not required 
to catch it (as servlets throw IOException automatically). 
 
@author Jon S. Stevens jon@working-dogs.com 
@author Serge Knystautas sergek@lokitech.com 
@version 1.0 
*/ 
public class ConnectionException extends IOException 
{ 
    /** 
     * @serial parent the parent exception 
     */ 
    Exception parent = null; 
    public ConnectionException () 
    { 
        super (); 
    } 
    /** 
      * This method was created in VisualAge. 
      * @param sqle SQLException 
      */ 
    public ConnectionException(Exception e) 
    { 
        parent = e; 
    } 
    public ConnectionException (String s) 
    { 
        super (s); 
    } 
    /** 
      * This method was created in VisualAge. 
      * @param sqle SQLException 
      */ 
    public ConnectionException(SQLException sqle) 
    { 
        parent = sqle; 
    } 
    public Throwable fillInStackTrace () 
    { 
        if (parent != null) 
            return parent.fillInStackTrace (); 
        else 
            return super.fillInStackTrace (); 
    } 
    public String getLocalizedMessage () 
    { 
        if (parent != null) 
            return parent.getLocalizedMessage (); 
        else 
            return super.getLocalizedMessage (); 
    } 
    public String getMessage () 
    { 
        if (parent != null) 
            return parent.getMessage (); 
        else 
            return super.getMessage (); 
    } 
    public void printStackTrace () 
    { 
        if (parent != null) 
            parent.printStackTrace (); 
        else 
            super.printStackTrace (); 
    } 
    public void printStackTrace (PrintStream s) 
    { 
        if (parent != null) 
            parent.printStackTrace (s); 
        else 
            super.printStackTrace (s); 
    } 
    public void printStackTrace (PrintWriter s) 
    { 
        if (parent != null) 
            parent.printStackTrace (s); 
        else 
            super.printStackTrace (s); 
    } 
    public String toString () 
    { 
        if (parent != null) 
            return "ConnectionException: " + parent.toString (); 
        else 
            return super.toString (); 
    } 
}