Package org.opencms.main
Class CmsException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.opencms.main.CmsException
-
- All Implemented Interfaces:
java.io.Serializable
,I_CmsThrowable
- Direct Known Subclasses:
CmsConfigurationException
,CmsDataAccessException
,CmsFlexCacheException
,CmsImportExportException
,CmsIndexException
,CmsInvalidActionException
,CmsLoaderException
,CmsLockException
,CmsMessageException
,CmsMultiException
,CmsNewParentNotInWorkflowException
,CmsPasswordEncryptionException
,CmsPublishException
,CmsResourceInitException
,CmsRfsException
,CmsSchedulerException
,CmsSearchException
,CmsSecurityException
,CmsStaticExportException
,CmsSynchronizeException
,CmsWidgetException
,CmsWorkplaceException
,CmsXmlException
public class CmsException extends java.lang.Exception implements I_CmsThrowable
Master exception type for all exceptions caused in OpenCms.- Since:
- 6.0.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected CmsMessageContainer
m_message
The container for the localized message.
-
Constructor Summary
Constructors Constructor Description CmsException(CmsMessageContainer message)
Creates a new localized Exception.CmsException(CmsMessageContainer message, java.lang.Throwable cause)
Creates a new localized Exception that also containers a root cause.
-
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.
-
-
-
Field Detail
-
m_message
protected CmsMessageContainer m_message
The container for the localized message.
-
-
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 usecause
- 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 containercause
- the root cause- Returns:
- a copied instance of this localized exception
-
getLocalizedMessage
public java.lang.String getLocalizedMessage()
Description copied from interface:I_CmsThrowable
Returns a localized exception message based on the OpenCms default locale.- Specified by:
getLocalizedMessage
in interfaceI_CmsThrowable
- Overrides:
getLocalizedMessage
in classjava.lang.Throwable
- Returns:
- a localized exception message based on the OpenCms default locale
- See Also:
I_CmsThrowable.getLocalizedMessage()
-
getLocalizedMessage
public java.lang.String getLocalizedMessage(java.util.Locale locale)
Description copied from interface:I_CmsThrowable
Returns a localized exception message based on the given Locale.- Specified by:
getLocalizedMessage
in interfaceI_CmsThrowable
- Parameters:
locale
- the Locale to get the message for- Returns:
- a localized exception message based on the given Locale
- See Also:
I_CmsThrowable.getLocalizedMessage(Locale)
-
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 interfaceI_CmsThrowable
- Overrides:
getMessage
in classjava.lang.Throwable
- Returns:
- a localized exception message based on the OpenCms default locale
- See Also:
Throwable.getMessage()
-
getMessageContainer
public CmsMessageContainer getMessageContainer()
Description copied from interface:I_CmsThrowable
Returns the localized message container used to build this localized exception.- Specified by:
getMessageContainer
in interfaceI_CmsThrowable
- Returns:
- the localized message container used to build this localized exception
- See Also:
I_CmsThrowable.getMessageContainer()
-
-