org.opengts.dbtools
Class DBException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.opengts.dbtools.DBException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DBAlreadyExistsException, DBNotAuthorizedException, DBNotFoundException

public class DBException
extends java.lang.Exception

DBException is the general exception thrown for various encountered SQL database errors.

See Also:
Serialized Form

Constructor Summary
DBException(java.lang.String msg)
          Constructor
DBException(java.lang.String msg, java.lang.Throwable cause)
          Constructor
 
Method Summary
 java.lang.String getCauseMessage()
          Gets the exception message, including the cause
 java.lang.String getMessage()
          Gets the exception message
 boolean isCauseCommunicationsException()
          Returns true if the cause of this exception is a MySQL CommunicationsException IE.
static boolean isCommunicationsException(java.lang.Throwable th)
          Returns true if the specified exception is a MySQL CommunicationsException IE.
 boolean isOutOfMemoryError()
          Returns true if the cause of this exception is an java.lang.OutOfMemoryError
 boolean isSQLException()
          Returns true if the cause of this exception is an SQLException
 void printException()
          Prints a description of this exception to the logging output
 java.lang.String toString()
          Returns a String representation of this exception
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DBException

public DBException(java.lang.String msg)
Constructor

Parameters:
msg - The message associated with this exception

DBException

public DBException(java.lang.String msg,
                   java.lang.Throwable cause)
Constructor

Parameters:
msg - The message associated with this exception
cause - The reason for this exception
Method Detail

isSQLException

public boolean isSQLException()
Returns true if the cause of this exception is an SQLException

Returns:
True if the cause of this exception is an SQLException

isCauseCommunicationsException

public boolean isCauseCommunicationsException()
Returns true if the cause of this exception is a MySQL CommunicationsException IE. "com.mysql.jdbc.exceptions.jdbc4.CommunicationsException"

Returns:
True if the cause is a MySQL CommunicationsException

isCommunicationsException

public static boolean isCommunicationsException(java.lang.Throwable th)
Returns true if the specified exception is a MySQL CommunicationsException IE. "com.mysql.jdbc.exceptions.jdbc4.CommunicationsException"

Parameters:
th - The Exception/Throwable to test
Returns:
True if the cause is a MySQL CommunicationsException

isOutOfMemoryError

public boolean isOutOfMemoryError()
Returns true if the cause of this exception is an java.lang.OutOfMemoryError

Returns:
True if the cause of this exception is an java.lang.OutOfMemoryError

getMessage

public java.lang.String getMessage()
Gets the exception message

Overrides:
getMessage in class java.lang.Throwable
Returns:
The exception message

getCauseMessage

public java.lang.String getCauseMessage()
Gets the exception message, including the cause

Returns:
The exception message, including the cause

printException

public void printException()
Prints a description of this exception to the logging output


toString

public java.lang.String toString()
Returns a String representation of this exception

Overrides:
toString in class java.lang.Throwable
Returns:
A String representation of this exception