java.lang.Object
java.lang.Throwable
java.lang.Exception
org.apache.derby.iapi.error.StandardException
- All Implemented Interfaces:
- java.io.Serializable
- public class StandardException
- extends java.lang.Exception
StandardException is the root of all exceptions that are handled
in a standard fashion by the database code, mainly in the language code.
This class is abstract to ensure that an implementation only throws
a specific exception (e.g. TransactionException) which is a sub-class
A method in an iterface in a protocol under com.ibm.db2j.protocol.Database must
only throw a StandardException (if it needs to throw an exception).
This indicates that the method can throw an exception and therefore its
caller must ensure that any resources it allocates will be cleaned up
in the event of an exception in the StandardException hierarchy.
Implementations of methods that throw StandardException can have throws
clause that are more specific than StandardException.
| Nested classes inherited from class java.lang.Throwable |
|
| Fields inherited from class java.lang.Exception |
|
| Fields inherited from class java.lang.Throwable |
|
|
Method Summary |
static StandardException |
closeException()
A special exception to close a session. |
static StandardException |
errorClose(java.lang.Throwable t)
|
java.lang.Object[] |
getArguments()
Returns the arguments for this exception,
if there are any. |
int |
getErrorCode()
|
java.lang.String |
getErrorProperty(java.lang.String type)
Get the error code for an error given a type. |
private static java.lang.String |
getErrorProperty(java.lang.String messageId,
java.lang.String type)
|
java.lang.String |
getMessage()
The message stored in the super class Throwable must be set
up object creation. |
java.lang.String |
getMessageId()
Return the message identifier that is used to look up the
error message text in the messages.properties file. |
java.lang.Throwable |
getNestedException()
Returns the nested exception for this exception,
if there is one. |
int |
getSeverity()
|
static int |
getSeverityFromIdentifier(java.lang.String messageID)
Get the severity given a message identifier from org.apache.derby.iapi.reference.SQLState. |
java.lang.String |
getSQLState()
Return the 5 character SQL State. |
static java.lang.String |
getSQLStateFromIdentifier(java.lang.String messageID)
Convert a message identifer from org.apache.derby.iapi.reference.SQLState to
a SQLState five character string. |
static StandardException |
interrupt(java.lang.InterruptedException ie)
|
static StandardException |
newException(java.lang.String messageID)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Object a1)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6,
java.lang.Object a7)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6,
java.lang.Object a7,
java.lang.Object a8)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Throwable t)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6,
java.lang.Object a7)
|
static StandardException |
newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6,
java.lang.Object a7,
java.lang.Object a8)
|
static StandardException |
newPreLocalizedException(java.lang.String MessageID,
java.lang.Throwable t,
java.lang.String localizedMessage)
Creates a new StandardException using message text that has already been localized. |
static java.sql.SQLWarning |
newWarning(java.lang.String messageId)
|
static java.sql.SQLWarning |
newWarning(java.lang.String messageId,
java.lang.Object a1)
|
static java.sql.SQLWarning |
newWarning(java.lang.String messageId,
java.lang.Object a1,
java.lang.Object a2)
|
private static java.sql.SQLWarning |
newWarningCommon(java.lang.String messageId,
java.lang.Object[] oa)
|
static StandardException |
normalClose()
|
static StandardException |
plainWrapException(java.lang.Throwable t)
Similar to unexpectedUserException but makes no assumtion about
when the execption is being called. |
int |
report()
Yes, report me. |
private void |
setArguments(java.lang.Object[] arguments)
Sets the arguments for this exception. |
void |
setNestedException(java.lang.Throwable nestedException)
Sets the nested exception for this exception. |
void |
setReport(int report)
Set my report type. |
void |
setSeverity(int severity)
|
java.lang.String |
toString()
Don't print the class name in the toString() method. |
static StandardException |
unexpectedUserException(java.lang.Throwable t)
|
REPORT_DEFAULT
public static final int REPORT_DEFAULT
- See Also:
- Constant Field Values
REPORT_NEVER
public static final int REPORT_NEVER
- See Also:
- Constant Field Values
REPORT_ALWAYS
public static final int REPORT_ALWAYS
- See Also:
- Constant Field Values
nestedException
private java.lang.Throwable nestedException
arguments
private transient java.lang.Object[] arguments
severity
private int severity
textMessage
private java.lang.String textMessage
sqlState
private java.lang.String sqlState
report
private transient int report
StandardException
protected StandardException(java.lang.String messageID)
StandardException
protected StandardException(java.lang.String messageID,
java.lang.Object[] args)
StandardException
protected StandardException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object[] args)
StandardException
private StandardException(java.lang.String sqlState,
java.lang.String text)
- This constructor is used when we already have the
message text.
setArguments
private final void setArguments(java.lang.Object[] arguments)
- Sets the arguments for this exception.
getArguments
public final java.lang.Object[] getArguments()
- Returns the arguments for this exception,
if there are any.
setNestedException
public final void setNestedException(java.lang.Throwable nestedException)
- Sets the nested exception for this exception.
getNestedException
public final java.lang.Throwable getNestedException()
- Returns the nested exception for this exception,
if there is one.
report
public final int report()
- Yes, report me. Errors that need this method to return
false are in the minority.
setReport
public final void setReport(int report)
- Set my report type.
setSeverity
public final void setSeverity(int severity)
getSeverity
public final int getSeverity()
getErrorCode
public final int getErrorCode()
getSQLState
public final java.lang.String getSQLState()
- Return the 5 character SQL State.
If you need teh identifier that was used to create the
message, then use getMessageId(). getMessageId() will return the
string that corresponds to the field in org.apache.derby.iapi.reference.SQLState.
getSQLStateFromIdentifier
public static java.lang.String getSQLStateFromIdentifier(java.lang.String messageID)
- Convert a message identifer from org.apache.derby.iapi.reference.SQLState to
a SQLState five character string.
getSeverityFromIdentifier
public static int getSeverityFromIdentifier(java.lang.String messageID)
- Get the severity given a message identifier from org.apache.derby.iapi.reference.SQLState.
normalClose
public static StandardException normalClose()
errorClose
public static StandardException errorClose(java.lang.Throwable t)
newException
public static StandardException newException(java.lang.String messageID)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Throwable t)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Object a1)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6,
java.lang.Object a7)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6,
java.lang.Object a7)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6,
java.lang.Object a7,
java.lang.Object a8)
newException
public static StandardException newException(java.lang.String messageID,
java.lang.Throwable t,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4,
java.lang.Object a5,
java.lang.Object a6,
java.lang.Object a7,
java.lang.Object a8)
newPreLocalizedException
public static StandardException newPreLocalizedException(java.lang.String MessageID,
java.lang.Throwable t,
java.lang.String localizedMessage)
- Creates a new StandardException using message text that has already been localized.
unexpectedUserException
public static StandardException unexpectedUserException(java.lang.Throwable t)
plainWrapException
public static StandardException plainWrapException(java.lang.Throwable t)
- Similar to unexpectedUserException but makes no assumtion about
when the execption is being called. The error is wrapped as simply
as possible.
closeException
public static StandardException closeException()
- A special exception to close a session.
getMessage
public java.lang.String getMessage()
- The message stored in the super class Throwable must be set
up object creation. At this time we cannot get any information
about the object itself (ie. this) in order to determine the
natural language message. Ie. we need to class of the objec in
order to look up its message, but we can't get the class of the
exception before calling the super class message.
Thus the message stored by Throwable and obtained by the
getMessage() of Throwable (ie. super.getMessage() in this
class) is the message identifier. The actual text message
is stored in this class at the first request.
getMessageId
public final java.lang.String getMessageId()
- Return the message identifier that is used to look up the
error message text in the messages.properties file.
getErrorProperty
public java.lang.String getErrorProperty(java.lang.String type)
- Get the error code for an error given a type. The value of
the property messageId.type will be returned, e.g.
deadlock.sqlstate.
toString
public java.lang.String toString()
- Don't print the class name in the toString() method.
getErrorProperty
private static java.lang.String getErrorProperty(java.lang.String messageId,
java.lang.String type)
interrupt
public static StandardException interrupt(java.lang.InterruptedException ie)
newWarning
public static java.sql.SQLWarning newWarning(java.lang.String messageId)
newWarning
public static java.sql.SQLWarning newWarning(java.lang.String messageId,
java.lang.Object a1)
newWarning
public static java.sql.SQLWarning newWarning(java.lang.String messageId,
java.lang.Object a1,
java.lang.Object a2)
newWarningCommon
private static java.sql.SQLWarning newWarningCommon(java.lang.String messageId,
java.lang.Object[] oa)