Package com.sun.identity.shared.locale
Class L10NMessageImpl
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.sun.identity.shared.locale.L10NMessageImpl
-
- All Implemented Interfaces:
L10NMessage,Serializable
- Direct Known Subclasses:
AMConfigurationException,AuthenticationException,AuthException,AuthnSvcException,ConfigurationException,COTException,DataStoreProviderException,DiscoveryException,EncryptionException,FSException,FSRedirectException,IDFFMetaException,InteractionException,LogException,PAOSException,PWResetException,RealmLookupException,SAML2Exception,SAMLException,ScriptException,SessionException,SessionException,SSOException,SystemConfigurationException,UpgradeException,ValidationException,ValidationException,WSFederationException
public class L10NMessageImpl extends Exception implements L10NMessage
Convenient implementation ofL10NMessageInterface. Extendsjava.lang.Exceptionan provides mechanism to provide resource bundle for error messages- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description L10NMessageImpl(String msg)L10NMessageImpl(String rbName, String errorCode, Object[] args)This constructor is used to pass the localized error message At this level, the locale of the caller is not known and it is not possible to throw localized error message at this level.L10NMessageImpl(String message, Throwable cause)L10NMessageImpl(Throwable ex)This constructor is used to extract localized error message from throwable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetErrorCode()Returns error code associated with this error message.StringgetL10NMessage(Locale locale)Returns localized error message.StringgetMessage()Returns message of the exception.Object[]getMessageArgs()Returns arguments for formatting this error message.StringgetResourceBundleName()Returns resource bundle name associated with this error message.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
L10NMessageImpl
public L10NMessageImpl(String msg)
-
L10NMessageImpl
public L10NMessageImpl(String rbName, String errorCode, Object[] args)
This constructor is used to pass the localized error message At this level, the locale of the caller is not known and it is not possible to throw localized error message at this level. Instead this constructor provides Resource Bundle name and errorCode for correctly locating the error messsage. The default getMessage() will always return English messages only. This is in consistent with current JRE- Parameters:
rbName- ResourceBundle Name to be used for getting localized error message.errorCode- Key to resource bundle. You can useResourceBundle rb = ResourceBunde.getBundle(rbName, locale); String localizedStr = rb.getString(errorCode);args- Arguments to message. If it is not present pass the as null.
-
L10NMessageImpl
public L10NMessageImpl(Throwable ex)
This constructor is used to extract localized error message from throwable.- Parameters:
ex- if the exception message is instance of L10NMessage, the bundleName,errorCode and args are extracted from throwable
-
-
Method Detail
-
getL10NMessage
public String getL10NMessage(Locale locale)
Returns localized error message.- Specified by:
getL10NMessagein interfaceL10NMessage- Parameters:
locale- Locale of the error message.- Returns:
- localized error message.
- See Also:
L10NMessageImpl(String, String, Object[])
-
getResourceBundleName
public String getResourceBundleName()
Returns resource bundle name associated with this error message.- Specified by:
getResourceBundleNamein interfaceL10NMessage- Returns:
- resource bundle name associated with this error message.
- See Also:
L10NMessageImpl(String, String, Object[])
-
getErrorCode
public String getErrorCode()
Returns error code associated with this error message.- Specified by:
getErrorCodein interfaceL10NMessage- Returns:
- error code associated with this error message.
- See Also:
L10NMessageImpl(String, String, Object[])
-
getMessageArgs
public Object[] getMessageArgs()
Returns arguments for formatting this error message. You need to useMessageFormatclass to format the message It can be null.- Specified by:
getMessageArgsin interfaceL10NMessage- Returns:
- arguments for formatting this error message.
- See Also:
L10NMessageImpl(String, String, Object[])
-
getMessage
public String getMessage()
Returns message of the exception.- Specified by:
getMessagein interfaceL10NMessage- Overrides:
getMessagein classThrowable- Returns:
- Message of the exception.
-
-