|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Throwable java.lang.Exception PIRL.Database.Database_Exception
public class Database_Exception
The excpetion thrown from the PIRL.Database package.
Field Summary | |
---|---|
static String |
DISCONNECTED_STATE
The two character "class" prefix of a five character SQLState value defined by the X/Open and SQL Access Group (Open Group) SQL CAE specification (1992) that indicates a failure to connect to the database. |
static String |
ID
Class identification name with source code version and date. |
Constructor Summary | |
---|---|
Database_Exception()
Constructs a Database_Exception. |
|
Database_Exception(String message)
Constructs a Database_Exception with a message. |
|
Database_Exception(String message,
Throwable cause)
Constructs a Database_Exception with a message and a cause. |
|
Database_Exception(Throwable cause)
Constructs a Database_Exception having a cause. |
Method Summary | |
---|---|
boolean |
Disconnected()
Tests if this Database_Exception was caused by an SQLException indicating loss of database connection. |
static String |
exception_String(Exception exception)
Generates a message String for an Exception. |
static String |
exception_String(Throwable throwable)
Generates a message String for a Throwable. |
static SQLException |
masked_SQLException(SQLException SQL_exception)
Copy an SQLException with any passwords masked out. |
static String |
masked_String(String string)
Masks out words that should be hidden in a String. |
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ID
public static final String DISCONNECTED_STATE
Constructor Detail |
---|
public Database_Exception(String message, Throwable cause)
The ID of this class will preceed the message. If a none-null message is specified it will be preceed with a new-line character. If a non-null cause is specified its message will be appended to the specified message after a new-line character.
Appending the cause's message to the specified message is done for backwards compatibility with the exceptions that did not support a chained cause. This can result in applications that expect to chain the cause messages themselves to get unexpected redundant messages.
N.B.: Once a cause is set it can not be changed. Therefore,
though it is allowed to set the cause to null, the Database_Exception
will not do this to avoid the situation of not being able to replace
a null cause with a valid cause. Use the Throwable.initCause(Throwable)
method to provide a cause after the
Configuration_Exception has been constructed without one.
message
- The exception's message String (may be null).cause
- The exception's Throwable cause (may be null).
If the cause is null, no cause is set in the exception object.public Database_Exception(Throwable cause)
The exception will have the ID of this class as its message.
cause
- The exception's Throwable cause (may be null).public Database_Exception(String message)
message
- The exception's message String (may be null).Database_Exception(String, Throwable)
public Database_Exception()
The exception will have the ID of this class as its message.
Database_Exception(String, Throwable)
Method Detail |
---|
public boolean Disconnected()
If the cause of the Database_Exception was itself a Database_Exception it's cause is recursivly checked.
DISCONNECTED_STATE
.public static String exception_String(Throwable throwable)
The String returned by the Throwable.getMessage()
method is
used. If the throwable is null or its message is null, the empty
String is used. This String has words that should be hidden masked
out.
If the throwable is a SQLException its message is preceed with a "SQL exception -" line and appended with two lines listing the SQL state and error codes of the exception.
throwable
- The Throwable from which to generate a message.public static String exception_String(Exception exception)
exception
- The Exception from which to generate a message.exception_String(Throwable)
public static String masked_String(String string)
When the word "password", "Password" or "PASSWORD" is encountered in the string the following word is replaced with "*******". The delimiters used to identify word characters are any of the " \t\n\r&:=" characters.
string
- The String to be masked.
Words.Mask(Vector)
,
Words.Delimiters(String)
public static SQLException masked_SQLException(SQLException SQL_exception)
A new SQLException is constructed containing a copy of the message
and state description from the specified SQLException with any
passwords masked out
in the message.
The stack track is also copied. If the SQLException has a chained
cause, that is copied over.
This method is applied recursively to any SQLException chained to the specified exception, and the resulting new SQLException used to replace the chained exception.
In effect, a deep copy of the specified SQLException is made with the message being masked in the process.
SQL_exception
- The SQLException to be masked and copied.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |