org.apache.uima

## Class UIMAException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - org.apache.uima.UIMAException

- All Implemented Interfaces:
    Serializable, I18nExceptionI
  Direct Known Subclasses:
    AnnotatorConfigurationException, AnnotatorContextException, AnnotatorInitializationException, AnnotatorProcessException, CASException, CollectionException, IndexingException, InvalidXMLException, ResourceAccessException, ResourceConfigurationException, ResourceInitializationException, ResourceProcessException, ResourceServiceException, ResultNotSupportedException

      public class UIMAException
      extends Exception
      implements I18nExceptionI

  This is the superclass for all checked exceptions in UIMA. It adds use of a "standard" bundle resource, if the subclasses don't define this.

  `UIMAException` extends `InternationalizedException` for internationalization support. Since UIMA Exceptions are internationalized, the thrower does not supply a hardcoded message. Instead, the thrower specifies a key that identifies the message. That key is then looked up in a locale-specific `ResourceBundle` to find the actual message associated with this exception.

  The thrower may specify the name of the `ResourceBundle` in which to find the exception message. Any name may be used. If the name is omitted, the resource bundle identified by `STANDARD_MESSAGE_CATALOG` will be used. This contains the standard UIMA exception messages.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `STANDARD_MESSAGE_CATALOG` The name of the `ResourceBundle` containing the standard UIMA Exception messages.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UIMAException()` Creates a new exception with a null message.
    `UIMAException(String aMessageKey, Object[] aArguments)` Creates a new exception with a message from the `STANDARD_MESSAGE_CATALOG`.
    `UIMAException(String aMessageKey, Object[] aArguments, Throwable aCause)` Creates a new exception with the specified cause and a message from the `STANDARD_MESSAGE_CATALOG`.
    `UIMAException(String aResourceBundleName, String aMessageKey, Object... aArguments)` Creates a new exception with a the specified message.
    `UIMAException(String aResourceBundleName, String aMessageKey, Object[] aArguments, Throwable aCause)` Creates a new exception with the specified message and cause.
    `UIMAException(Throwable aCause)` Creates a new exception with the specified cause and a null message.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object[]` | `getArguments()` Gets the arguments to this exception's message.
    `Throwable` | `getCause()` Gets the cause of this Exception.
    `String` | `getLocalizedMessage()` Gets the localized detail message for this exception.
    `String` | `getMessage()` Due to the fact that superclass definitions override any default methods, these next must be in the class definitions as they override other supertype methods.
    `String` | `getMessageKey()` Gets the identifier for this exception's message.
    `String` | `getResourceBundleName()` Gets the base name of the resource bundle in which the message for this exception is located.
    `Throwable` | `initCause(Throwable cause)`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.uima.I18nExceptionI

      `getLocalizedMessage, hasMessageKey`

- - ### Field Detail

    - #### STANDARD_MESSAGE_CATALOG

          public static final String STANDARD_MESSAGE_CATALOG

      The name of the `ResourceBundle` containing the standard UIMA Exception messages.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### UIMAException

          public UIMAException()

      Creates a new exception with a null message.

    - #### UIMAException

          public UIMAException(Throwable aCause)

      Creates a new exception with the specified cause and a null message.
      Parameters:
        `aCause` - the original exception that caused this exception to be thrown, if any

    - #### UIMAException

          public UIMAException(String aResourceBundleName,
                               String aMessageKey,
                               Object... aArguments)

      Creates a new exception with a the specified message.
      Parameters:
        `aResourceBundleName` - the base name of the resource bundle in which the message for this exception is located.
        `aMessageKey` - an identifier that maps to the message for this exception. The message may contain placeholders for arguments as defined by the `MessageFormat` class.
        `aArguments` - The arguments to the message. `null` may be used if the message has no arguments.

    - #### UIMAException

          public UIMAException(String aResourceBundleName,
                               String aMessageKey,
                               Object[] aArguments,
                               Throwable aCause)

      Creates a new exception with the specified message and cause.
      Parameters:
        `aResourceBundleName` - the base name of the resource bundle in which the message for this exception is located.
        `aMessageKey` - an identifier that maps to the message for this exception. The message may contain placeholders for arguments as defined by the `MessageFormat` class.
        `aArguments` - The arguments to the message. `null` may be used if the message has no arguments.
        `aCause` - the original exception that caused this exception to be thrown, if any

    - #### UIMAException

          public UIMAException(String aMessageKey,
                               Object[] aArguments)

      Creates a new exception with a message from the `STANDARD_MESSAGE_CATALOG`.
      Parameters:
        `aMessageKey` - an identifier that maps to the message for this exception. The message may contain placeholders for arguments as defined by the `MessageFormat` class.
        `aArguments` - The arguments to the message. `null` may be used if the message has no arguments.

    - #### UIMAException

          public UIMAException(String aMessageKey,
                               Object[] aArguments,
                               Throwable aCause)

      Creates a new exception with the specified cause and a message from the `STANDARD_MESSAGE_CATALOG`.
      Parameters:
        `aMessageKey` - an identifier that maps to the message for this exception. The message may contain placeholders for arguments as defined by the `MessageFormat` class.
        `aArguments` - The arguments to the message. `null` may be used if the message has no arguments.
        `aCause` - the original exception that caused this exception to be thrown, if any

  - ### Method Detail

    - #### getCause

          public Throwable getCause()

      Gets the cause of this Exception.
      Specified by:
        `getCause` in interface `I18nExceptionI`
      Overrides:
        `getCause` in class `Throwable`
      Returns:
        the Throwable that caused this Exception to occur, if any. Returns `null` if there is no such cause.

    - #### initCause

          public Throwable initCause(Throwable cause)

      Overrides:
        `initCause` in class `Throwable`

    - #### getResourceBundleName

          public String getResourceBundleName()

      Gets the base name of the resource bundle in which the message for this exception is located.
      Specified by:
        `getResourceBundleName` in interface `I18nExceptionI`
      Returns:
        the resource bundle base name. May return `null` if this exception has no message.

    - #### getMessageKey

          public String getMessageKey()

      Gets the identifier for this exception's message. This identifier can be looked up in this exception's `ResourceBundle` to get the locale-specific message for this exception.
      Specified by:
        `getMessageKey` in interface `I18nExceptionI`
      Returns:
        the resource identifier for this exception's message. May return `null` if this exception has no message.

    - #### getArguments

          public Object[] getArguments()

      Gets the arguments to this exception's message. Arguments allow a `InternationalizedException` to have a compound message, made up of multiple parts that are concatenated in a language-neutral way.
      Specified by:
        `getArguments` in interface `I18nExceptionI`
      Returns:
        the arguments to this exception's message.

    - #### getMessage

          public String getMessage()

      Description copied from interface: `I18nExceptionI`
      Due to the fact that superclass definitions override any default methods, these next must be in the class definitions as they override other supertype methods.
      Specified by:
        `getMessage` in interface `I18nExceptionI`
      Overrides:
        `getMessage` in class `Throwable`
      Returns:
        The message of the exception. Useful for including the text in another exception.

    - #### getLocalizedMessage

          public String getLocalizedMessage()

      Gets the localized detail message for this exception. This uses the default Locale for this JVM. A Locale may be specified using `I18nExceptionI.getLocalizedMessage(Locale)`.
      Specified by:
        `getLocalizedMessage` in interface `I18nExceptionI`
      Overrides:
        `getLocalizedMessage` in class `Throwable`
      Returns:
        this exception's detail message, localized for the default Locale.

Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.