Class InternationalizedRuntimeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.apache.uima.InternationalizedRuntimeException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
PackageInstallerException,UIMARuntimeException
public class InternationalizedRuntimeException extends java.lang.RuntimeExceptionTheInternationalizedRuntimeExceptionclass adds internationalization support to the standard functionality provided byjava.lang.RuntimeException. Because this is aRuntimeException, it does not need to be declared in the throws clause of methods.To support internationalization, the thrower of an exception must not specify a hardcoded message string. Instead, the thrower specifies a key that identifies the message. That key is then looked up in a locale-specific
ResourceBundleto find the actual message associated with this exception.This class also supports arguments to messages. The full message will be constructed using the
MessageFormatclass. For more information on internationalization, see the Java Internationalization Guide.This version of this class works with JDK versions prior to 1.4, since it does not assume support for exception chaining. The file
InternationalizedException.java_1_4is a version that uses the exception chaining support built-in to JDK1.4.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InternationalizedRuntimeException()Creates a newInternationalizedRuntimeExceptionwith a null message.InternationalizedRuntimeException(java.lang.String aResourceBundleName, java.lang.String aMessageKey, java.lang.Object[] aArguments)Creates a newInternationalizedRuntimeExceptionwith the specified message.InternationalizedRuntimeException(java.lang.String aResourceBundleName, java.lang.String aMessageKey, java.lang.Object[] aArguments, java.lang.Throwable aCause)Creates a newInternationalizedRuntimeExceptionwith the specified message and cause.InternationalizedRuntimeException(java.lang.Throwable aCause)Creates a newInternationalizedRuntimeExceptionwith the specified cause and a null message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object[]getArguments()Gets the arguments to this exception's message.java.lang.ThrowablegetCause()Gets the cause of this Exception.java.lang.StringgetLocalizedMessage()Gets the localized detail message for this exception.java.lang.StringgetLocalizedMessage(java.util.Locale aLocale)Gets the localized detail message for this exception using the specifiedLocale.java.lang.StringgetMessage()Gets the English detail message for this exception.java.lang.StringgetMessageKey()Gets the identifier for this exception's message.java.lang.StringgetResourceBundleName()Gets the base name of the resource bundle in which the message for this exception is located.java.lang.ThrowableinitCause(java.lang.Throwable cause)
-
-
-
Constructor Detail
-
InternationalizedRuntimeException
public InternationalizedRuntimeException()
Creates a newInternationalizedRuntimeExceptionwith a null message.
-
InternationalizedRuntimeException
public InternationalizedRuntimeException(java.lang.Throwable aCause)
Creates a newInternationalizedRuntimeExceptionwith the specified cause and a null message.- Parameters:
aCause- the original exception that caused this exception to be thrown, if any
-
InternationalizedRuntimeException
public InternationalizedRuntimeException(java.lang.String aResourceBundleName, java.lang.String aMessageKey, java.lang.Object[] aArguments)Creates a newInternationalizedRuntimeExceptionwith 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 theMessageFormatclass.aArguments- The arguments to the message.nullmay be used if the message has no arguments.
-
InternationalizedRuntimeException
public InternationalizedRuntimeException(java.lang.String aResourceBundleName, java.lang.String aMessageKey, java.lang.Object[] aArguments, java.lang.Throwable aCause)Creates a newInternationalizedRuntimeExceptionwith 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 theMessageFormatclass.aArguments- The arguments to the message.nullmay be used if the message has no arguments.aCause- the original exception that caused this exception to be thrown, if any
-
-
Method Detail
-
getResourceBundleName
public java.lang.String getResourceBundleName()
Gets the base name of the resource bundle in which the message for this exception is located.- Returns:
- the resource bundle base name. May return
nullif this exception has no message.
-
getMessageKey
public java.lang.String getMessageKey()
Gets the identifier for this exception's message. This identifier can be looked up in this exception'sResourceBundleto get the locale-specific message for this exception.- Returns:
- the resource identifier for this exception's message. May return
nullif this exception has no message.
-
getArguments
public java.lang.Object[] getArguments()
Gets the arguments to this exception's message. Arguments allow aInternationalizedRuntimeExceptionto have a compound message, made up of multiple parts that are concatenated in a language-neutral way.- Returns:
- the arguments to this exception's message.
-
getMessage
public java.lang.String getMessage()
Gets the English detail message for this exception. For the localized message usegetLocalizedMessage().- Overrides:
getMessagein classjava.lang.Throwable- Returns:
- the English detail message for this exception.
-
getLocalizedMessage
public java.lang.String getLocalizedMessage()
Gets the localized detail message for this exception. This uses the default Locale for this JVM. A Locale may be specified usinggetLocalizedMessage(Locale).- Overrides:
getLocalizedMessagein classjava.lang.Throwable- Returns:
- this exception's detail message, localized for the default Locale.
-
getLocalizedMessage
public java.lang.String getLocalizedMessage(java.util.Locale aLocale)
Gets the localized detail message for this exception using the specifiedLocale.- Parameters:
aLocale- the locale to use for localizing the message- Returns:
- this exception's detail message, localized for the specified
Locale.
-
getCause
public java.lang.Throwable getCause()
Gets the cause of this Exception.- Overrides:
getCausein classjava.lang.Throwable- Returns:
- the Throwable that caused this Exception to occur, if any. Returns
nullif there is no such cause.
-
initCause
public java.lang.Throwable initCause(java.lang.Throwable cause)
- Overrides:
initCausein classjava.lang.Throwable
-
-