Class CmsException

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CmsException createException​(CmsMessageContainer container, java.lang.Throwable cause)
      Creates a copied instance of this localized exception.
      static java.lang.String getFormattedErrorstack​(java.lang.Throwable t)
      Returns the HTML formatted error stack of a Throwable.
      java.lang.String getLocalizedMessage()
      Returns a localized exception message based on the OpenCms default locale.
      java.lang.String getLocalizedMessage​(java.util.Locale locale)
      Returns a localized exception message based on the given Locale.
      java.lang.String getMessage()
      Returns a localized exception message based on the OpenCms default locale.
      CmsMessageContainer getMessageContainer()
      Returns the localized message container used to build this localized exception.
      static java.lang.String getStackTraceAsString​(java.lang.Throwable e)
      Returns the stack trace (including the message) of an exception as a String.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

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

      • CmsException

        public CmsException​(CmsMessageContainer message)
        Creates a new localized Exception.

        Parameters:
        message - the localized message container to use
      • CmsException

        public CmsException​(CmsMessageContainer message,
                            java.lang.Throwable cause)
        Creates a new localized Exception that also containers a root cause.

        Parameters:
        message - the localized message container to use
        cause - the Exception root cause
    • Method Detail

      • getFormattedErrorstack

        public static java.lang.String getFormattedErrorstack​(java.lang.Throwable t)
        Returns the HTML formatted error stack of a Throwable.

        The error stack is used by the common error screen that is displayed if an error occurs.

        Parameters:
        t - the throwable to get the errorstack from
        Returns:
        the formatted value of the errorstack parameter
      • getStackTraceAsString

        public static java.lang.String getStackTraceAsString​(java.lang.Throwable e)
        Returns the stack trace (including the message) of an exception as a String.

        If the exception is a CmsException, also writes the root cause to the String.

        Parameters:
        e - the exception to get the stack trace from
        Returns:
        the stack trace of an exception as a String
      • createException

        public CmsException createException​(CmsMessageContainer container,
                                            java.lang.Throwable cause)
        Creates a copied instance of this localized exception.

        Parameters:
        container - the message container
        cause - the root cause
        Returns:
        a copied instance of this localized exception
      • getMessage

        public java.lang.String getMessage()
        Description copied from interface: I_CmsThrowable
        Returns a localized exception message based on the OpenCms default locale.

        Specified by:
        getMessage in interface I_CmsThrowable
        Overrides:
        getMessage in class java.lang.Throwable
        Returns:
        a localized exception message based on the OpenCms default locale
        See Also:
        Throwable.getMessage()