public class InternationalizedRuntimeException extends RuntimeException
InternationalizedRuntimeException class adds internationalization support to the
 standard functionality provided by java.lang.RuntimeException. Because this is a
 RuntimeException, 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 ResourceBundle to find the actual
 message associated with this exception.
 
 This class also supports arguments to messages. The full message will be constructed using the
 MessageFormat class. 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_4 is a version
 that uses the exception chaining support built-in to JDK1.4.
| Constructor and Description | 
|---|
| InternationalizedRuntimeException()Creates a new  InternationalizedRuntimeExceptionwith a null message. | 
| InternationalizedRuntimeException(String aResourceBundleName,
                                 String aMessageKey,
                                 Object[] aArguments)Creates a new  InternationalizedRuntimeExceptionwith the specified message. | 
| InternationalizedRuntimeException(String aResourceBundleName,
                                 String aMessageKey,
                                 Object[] aArguments,
                                 Throwable aCause)Creates a new  InternationalizedRuntimeExceptionwith the specified message and
 cause. | 
| InternationalizedRuntimeException(Throwable aCause)Creates a new  InternationalizedRuntimeExceptionwith the specified cause and a
 null message. | 
| 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 | getLocalizedMessage(Locale aLocale)Gets the localized detail message for this exception using the specified  Locale. | 
| String | getMessage()Gets the English detail message for this exception. | 
| 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) | 
| void | setResourceBundle(Locale aLocale)For the case where the default locale is not being used for getting messages, and the lookup
 path in the classpath for the resource bundle needs to be set at a specific point, call this
 method to set the resource bundle at that point in the call stack. | 
addSuppressed, fillInStackTrace, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic InternationalizedRuntimeException()
InternationalizedRuntimeException with a null message.public InternationalizedRuntimeException(Throwable aCause)
InternationalizedRuntimeException with the specified cause and a
 null message.aCause - the original exception that caused this exception to be thrown, if anypublic InternationalizedRuntimeException(String aResourceBundleName, String aMessageKey, Object[] aArguments)
InternationalizedRuntimeException with the specified message.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.public InternationalizedRuntimeException(String aResourceBundleName, String aMessageKey, Object[] aArguments, Throwable aCause)
InternationalizedRuntimeException with the specified message and
 cause.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 anypublic String getResourceBundleName()
null if this exception has no
         message.public String getMessageKey()
ResourceBundle to get the locale-specific message
 for this exception.null if
         this exception has no message.public Object[] getArguments()
InternationalizedRuntimeException to have a compound message, made up of multiple
 parts that are concatenated in a language-neutral way.public String getMessage()
getLocalizedMessage().getMessage in class Throwablepublic String getLocalizedMessage()
getLocalizedMessage(Locale).getLocalizedMessage in class Throwablepublic String getLocalizedMessage(Locale aLocale)
Locale.aLocale - the locale to use for localizing the messageLocale.public Throwable getCause()
public void setResourceBundle(Locale aLocale)
Exception e = new AnalysisEngineProcessException(MESSAGE_BUNDLE, "TEST_KEY", objects); e.setResourceBundle(my_locale); // call this method, pass in the needed locale object throw e; // or whatever should be done with it then do something like this
Exception e = new AnalysisEngineProcessException(MESSAGE_BUNDLE, "TEST_KEY", objects); e.setResourceBundle(my_locale); // call this method, pass in the needed locale object throw e; // or whatever should be done with it
aLocale - the locale to use when getting the message from the message bundle at a later timeCopyright © 2006–2022 The Apache Software Foundation. All rights reserved.