Class 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 from SQLState.
      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 given SQLState string constant is a deferred constraint transactional error.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExceptionUtil

        public ExceptionUtil()
    • 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 from SQLState.
        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 given SQLState string constant is a deferred constraint transactional error. If this is so, return true, else return false.
        Parameters:
        e - the string with the SQL state
        Returns:
        see method description