Package org.apache.derby.iapi.error
Class ExceptionUtil
- java.lang.Object
-
- org.apache.derby.iapi.error.ExceptionUtil
-
public class ExceptionUtil extends java.lang.Object
This class provides utility routines for exceptions
-
-
Constructor Summary
Constructors Constructor Description ExceptionUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
dumpThreads()
Dumps stack traces for all the threads if the JVM supports it.static int
getSeverityFromIdentifier(java.lang.String messageID)
Get the severity given a message identifier fromSQLState
.static java.lang.String
getSQLStateFromIdentifier(java.lang.String messageID)
Convert a message identifier from org.apache.derby.shared.common.reference.SQLState to a SQLState five character string.static boolean
isDeferredConstraintViolation(java.lang.String e)
Determine if the givenSQLState
string constant is a deferred constraint transactional error.
-
-
-
Method Detail
-
getSQLStateFromIdentifier
public static java.lang.String getSQLStateFromIdentifier(java.lang.String messageID)
Convert a message identifier from org.apache.derby.shared.common.reference.SQLState to a SQLState five character string.- Parameters:
messageID
- - the sql state id of the message from Derby- Returns:
- String - the 5 character code of the SQLState ID to returned to the user
-
getSeverityFromIdentifier
public static int getSeverityFromIdentifier(java.lang.String messageID)
Get the severity given a message identifier fromSQLState
.- Parameters:
messageID
- the string carrying the SQL state- Returns:
- the constant representing the severity, as defined in
ExceptionSeverity
.
-
dumpThreads
public static java.lang.String dumpThreads()
Dumps stack traces for all the threads if the JVM supports it. The result is returned as a string, ready to print. If the JVM doesn't have the method Thread.getAllStackTraces i.e, we are on a JVM < 1.5, or if we don't have the permissions: java.lang.RuntimePermission "getStackTrace" and "modifyThreadGroup", a message saying so is returned instead.- Returns:
- stack traces for all live threads as a string or an error message.
-
isDeferredConstraintViolation
public static boolean isDeferredConstraintViolation(java.lang.String e)
Determine if the givenSQLState
string constant is a deferred constraint transactional error. If this is so, returntrue
, else returnfalse
.- Parameters:
e
- the string with the SQL state- Returns:
- see method description
-
-