org.opencms.main
Class CmsRuntimeException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.opencms.main.CmsRuntimeException
All Implemented Interfaces:
java.io.Serializable, I_CmsThrowable
Direct Known Subclasses:
CmsIllegalArgumentException, CmsIllegalStateException, CmsInitException

public class CmsRuntimeException
extends java.lang.RuntimeException
implements I_CmsThrowable

A replacement for RuntimeException to obtain fully localized exception messages for OpenCms.

Since:
6.0.0
Version:
$Revision: 1.13 $
Author:
Alexander Kandzior
See Also:
Serialized Form

Field Summary
protected  CmsMessageContainer m_message
          The container for the localized message.
 
Constructor Summary
CmsRuntimeException(CmsMessageContainer message)
          Creates a new localized Exception.
CmsRuntimeException(CmsMessageContainer message, java.lang.Throwable cause)
          Creates a new localized Exception that also containes a root cause.
 
Method Summary
 CmsRuntimeException createException(CmsMessageContainer container, java.lang.Throwable cause)
          Creates a copied instance of this localized exception.
 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.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_message

protected CmsMessageContainer m_message
The container for the localized message.

Constructor Detail

CmsRuntimeException

public CmsRuntimeException(CmsMessageContainer message)
Creates a new localized Exception.

Parameters:
message - the localized message container to use

CmsRuntimeException

public CmsRuntimeException(CmsMessageContainer message,
                           java.lang.Throwable cause)
Creates a new localized Exception that also containes a root cause.

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

createException

public CmsRuntimeException 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

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 interface I_CmsThrowable
Overrides:
getLocalizedMessage in class java.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 interface I_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 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()

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 interface I_CmsThrowable
Returns:
the localized message container used to build this localized exception
See Also:
I_CmsThrowable.getMessageContainer()