Class CmsMultiException

  • All Implemented Interfaces:
    java.io.Serializable, I_CmsThrowable

    public class CmsMultiException
    extends CmsException
    A multi exception is a container for several exception messages that may be caused by an internal operation.

    This is provided so that the user can see a full picture of all the issues that have been caused in an operation, rather then only one (usually the first) issue.

    Since:
    2.0.0
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addException​(CmsException exception)
      Adds an Exception to the list of Exceptions kept in this multi Exception.
      void addExceptions​(java.util.List<CmsException> exceptions)
      Adds all Exceptions in the given List to the list of Exceptions kept in this multi Exception.
      CmsException createException​(CmsMessageContainer container, java.lang.Throwable cause)
      Creates a copied instance of this localized exception.
      java.util.List<CmsException> getExceptions()
      Returns the (unmodifiable) List of exceptions that are stored in this multi exception.
      java.lang.String getLocalizedMessage()
      Returns a localized message composed of all contained exceptions.
      java.lang.String getLocalizedMessage​(java.util.Locale locale)
      Returns a localized message for the given locale composed of all contained exceptions.
      java.lang.String getMessage​(java.util.Locale locale)
      Returns the individual message (if set) or an empty String.
      boolean hasExceptions()
      Returns true if this multi exceptions contains at last one individual Exception.
      boolean hasIndividualMessage()
      Returns true if this multi message has an individual base message set.
      protected void setExceptions​(java.util.List<CmsException> exceptions)
      Updates the internal list of stored exceptions.
      void setMessage​(CmsMessageContainer message)
      Sets an individual message for the multi exception base message.
      protected void updateMessage()
      Updates the intenal message for the Exception.
      • 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
    • Field Detail

      • m_individualMessage

        protected boolean m_individualMessage
        Indicates if the message has been set as individual message.
    • Method Detail

      • addException

        public void addException​(CmsException exception)
        Adds an Exception to the list of Exceptions kept in this multi Exception.

        Parameters:
        exception - the Exception to add
      • addExceptions

        public void addExceptions​(java.util.List<CmsException> exceptions)
        Adds all Exceptions in the given List to the list of Exceptions kept in this multi Exception.

        Parameters:
        exceptions - the Exceptions to add
      • getExceptions

        public java.util.List<CmsExceptiongetExceptions()
        Returns the (unmodifiable) List of exceptions that are stored in this multi exception.

        Returns:
        the (unmodifiable) List of exceptions that are stored in this multi exception
      • getMessage

        public java.lang.String getMessage​(java.util.Locale locale)
        Returns the individual message (if set) or an empty String.

        Parameters:
        locale - the locale for the message to generate
        Returns:
        the individual message (if set) or an empty String
      • hasExceptions

        public boolean hasExceptions()
        Returns true if this multi exceptions contains at last one individual Exception.

        Returns:
        true if this multi exceptions contains at last one individual Exception
      • setMessage

        public void setMessage​(CmsMessageContainer message)
        Sets an individual message for the multi exception base message.

        If no individual message has been set, a default message using the key Messages.ERR_MULTI_EXCEPTION_1 will be used.

        If null is given as parameter, any individual message that has been set is reset to the default message.

        Parameters:
        message - the message to set
      • setExceptions

        protected void setExceptions​(java.util.List<CmsException> exceptions)
        Updates the internal list of stored exceptions.

        Parameters:
        exceptions - the exceptions to use (will replace the current exception list)
      • updateMessage

        protected void updateMessage()
        Updates the intenal message for the Exception.