|
uPortal 2.4.1 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasig.portal.lang.ThrowableHelper
The ThrowableHelper
class defines a set of utility
methods for handling common error management operations in a
fashion which takes advantage of the J2SDK 1.4 constructs while
maintaining J2SDK 1.3 compatibility.
Method Summary | |
static java.lang.Throwable |
create(java.lang.Class throwableClass,
java.lang.Class client,
java.lang.String propertyName,
java.lang.String[] args,
java.lang.Throwable cause)
Creates the specified Throwable object with the
internationalized error code and arguments. |
static ThrowableHandler |
getDefaultHandler(java.lang.String className)
Returns a constructed instance of the default handler. |
static java.lang.String |
getInternationalizedMessage(java.lang.Class client,
java.lang.String error)
Returns an internationalized error message which can be reconstructed into a localized error message with the getLocalizedMessage method call. |
static java.lang.String |
getInternationalizedMessage(java.lang.Class client,
java.lang.String error,
java.lang.String[] objects)
Returns an internationalized error message which can be reconstructed into a localized error message with the getLocalizedMessage method call. |
static java.lang.String |
getLocalizedMessage(java.lang.String i18nMessage)
Returns the localized error message associated with the specified internationalized error message constructed with the getInternationalizedMessage method. |
static java.lang.String |
getLocalizedMessage(java.lang.String i18nMessage,
java.util.Locale locale)
Returns the localized error message associated with the specified internationalized error message constructed with the getInternationalizedMessage method. |
static java.lang.String |
getLocalizedMessage(java.lang.Throwable throwable)
Returns the localized string associated with the argument. |
static java.lang.String |
getLocalizedMessage(java.lang.Throwable throwable,
java.util.Locale locale)
Returns the localized string associated with the argument in the specified locale, if possible. |
static void |
handle(java.lang.Class client,
java.lang.String message,
java.lang.String[] objects,
java.lang.Throwable cause)
Handles the throwable condition specified in the parameters. |
static void |
handle(java.lang.Class client,
java.lang.String message,
java.lang.String[] objects,
java.lang.Throwable cause,
ThrowableHandler handler)
Handles the throwable condition specified in the parameters. |
static void |
handle(java.lang.Throwable cause)
Handles the throwable condition specified in the parameter. |
static void |
initCause(java.lang.Throwable throwable,
java.lang.Throwable cause)
Initizlizes the chained cause of the throwable if possible using the J2SDK 1.4 constructs. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static final ThrowableHandler getDefaultHandler(java.lang.String className)
ThrowableHandler
interface and have an
accessible default constructor.
className
- name of the throwable handler class
public static final java.lang.String getInternationalizedMessage(java.lang.Class client, java.lang.String error)
getLocalizedMessage
method call.
client
- class of the client making this callerror
- error property name of the error condition
public static final java.lang.String getInternationalizedMessage(java.lang.Class client, java.lang.String error, java.lang.String[] objects)
getLocalizedMessage
method call.
client
- class of the client making this callerror
- error property name of the error conditionobjects
- string objects which should be stored for the
message
java.lang.NullPointerException
- if client, or error parameters are
nullpublic static final java.lang.String getLocalizedMessage(java.lang.String i18nMessage)
getInternationalizedMessage
method. The default
locale is used.
i18nMessage
- internationalized error message
null
public static final java.lang.String getLocalizedMessage(java.lang.Throwable throwable)
throwable
- object whose message is to be localized
Throwable
public static final java.lang.String getLocalizedMessage(java.lang.Throwable throwable, java.util.Locale locale)
throwable
- object whose message is to be localizedlocale
- locale to localized the message
Throwable
public static final java.lang.String getLocalizedMessage(java.lang.String i18nMessage, java.util.Locale locale)
getInternationalizedMessage
method. The locale of
for the translation is picked up from the current session.
i18nMessage
- internationalized error messagelocale
- locale to translate the message
null
public static final void initCause(java.lang.Throwable throwable, java.lang.Throwable cause)
throwable
- throwable whose cause should be setcause
- throwable which caused the throwable conditionpublic static final java.lang.Throwable create(java.lang.Class throwableClass, java.lang.Class client, java.lang.String propertyName, java.lang.String[] args, java.lang.Throwable cause)
Throwable
object with the
internationalized error code and arguments. If the cause object
is not null, the specified object's initCause
method will be invoked reflectively to enable the standard
chaining constructs. The specified error code is an
internationalized error property value which must be defined in
a resource bundle associated with the client, specificifically
the code will perform a ResourceBundle.getBundle( )
to resolve the resource.
Invoking this method is equivalent to creating the
Throwable
with an internationalized message and
then invoking ThrowableHelper.initCause
, e.g.,:
Throwable someCause = ...
String i18nMessage = ThrowableHelper.getInternationalizedMessage(
MyApplication.class,
"myapplication.some_error_code",
new String[]{ "32", "1024" }
);
IllegalArgumentException iae = new IllegalArgumentException(
i18nMessage
);
ThrowableHelper.initCause(
iae,
someCause
);
throwableClass
- throwable object to be constructedclient
- class file of the clientpropertyName
- internationalized error code property name
defined in the client's resouce bundleargs
- arguments for the localized messagecause
- cause of the created exception, or
null
public static final void handle(java.lang.Throwable cause)
cause
- throwable condition which should be handledpublic static final void handle(java.lang.Class client, java.lang.String message, java.lang.String[] objects, java.lang.Throwable cause)
client
- client performing the handlingcause
- throwable condition which should be handledmessage
- associated with handling the errorobjects
- associated with the error messagepublic static final void handle(java.lang.Class client, java.lang.String message, java.lang.String[] objects, java.lang.Throwable cause, ThrowableHandler handler)
null
the default handler
is used; otherwise, the specified handler is used to process
this request.
client
- client performing the handlingcause
- throwable condition which should be handledmessage
- associated with handling the errorobjects
- associated with the error messagehandler
- which should be executed instead of the default
handler
|
uPortal 2.4.1 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |