Class AuthLoginException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.security.GeneralSecurityException
-
- javax.security.auth.login.LoginException
-
- com.sun.identity.authentication.spi.AuthLoginException
-
- All Implemented Interfaces:
L10NMessage,Serializable
- Direct Known Subclasses:
InvalidPasswordException,LoginTimeOutException,MessageLoginException,UserNamePasswordValidationException
public class AuthLoginException extends LoginException implements L10NMessage
This class is for handling message localization in LoginException.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AuthLoginException(String message)Constructs a newAuthLoginExceptionwith the given message.AuthLoginException(String rbName, String errorCode, Object[] args)Constructs a newAuthLoginExceptionwithout a nestedThrowable.AuthLoginException(String rbName, String errorCode, Object[] args, Throwable nestedException)Constructs an instance ofAuthLoginExceptionto 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.AuthLoginException(String message, Throwable nestedException)Constructs an exception with given message and the nested exception.AuthLoginException(Throwable nestedException)Constructs anAuthLoginExceptionwith givenThrowable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetErrorCode()Returns the error code.StringgetL10NMessage(Locale locale)Returns the localized message of the given locale.StringgetMessage()Gets messages of the exceptions including the nested exceptions.Object[]getMessageArgs()Returns the error message arguments.StringgetResourceBundleName()Returns the resource bundle name.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
AuthLoginException
public AuthLoginException(String message, Throwable nestedException)
Constructs an exception with given message and the nested exception.- Parameters:
message- message of this exceptionnestedException- Exception caught by the code block throwing this exception
-
AuthLoginException
public AuthLoginException(Throwable nestedException)
Constructs anAuthLoginExceptionwith givenThrowable.- Parameters:
nestedException- Exception nested in the new exception.
-
AuthLoginException
public AuthLoginException(String message)
Constructs a newAuthLoginExceptionwith the given message.- Parameters:
message- message for this exception. This message can be later retrieved bygetMessage()method.
-
AuthLoginException
public AuthLoginException(String rbName, String errorCode, Object[] args, Throwable nestedException)
Constructs an instance ofAuthLoginExceptionto 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 anderrorCodefor correctly locating the error message. The defaultgetMessage()will always return English messages only. This is consistent with current JRE.- Parameters:
rbName- Resource Bundle 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 them as nullnestedException- The nestedThrowable.
-
AuthLoginException
public AuthLoginException(String rbName, String errorCode, Object[] args)
Constructs a newAuthLoginExceptionwithout a nestedThrowable.- Parameters:
rbName- Resource Bundle 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 them as null
-
-
Method Detail
-
getL10NMessage
public String getL10NMessage(Locale locale)
Returns the localized message of the given locale.- Specified by:
getL10NMessagein interfaceL10NMessage- Parameters:
locale- the locale in which the message will be returned.- Returns:
- String localized error message.
-
getResourceBundleName
public String getResourceBundleName()
Returns the resource bundle name.- Specified by:
getResourceBundleNamein interfaceL10NMessage- Returns:
- Resource Bundle Name associated with this error message.
-
getErrorCode
public String getErrorCode()
Returns the error code.- Specified by:
getErrorCodein interfaceL10NMessage- Returns:
- Error code associated with this error message.
-
getMessageArgs
public Object[] getMessageArgs()
Returns the error message arguments.- Specified by:
getMessageArgsin interfaceL10NMessage- Returns:
- arguments for formatting this error message. You need to use
MessageFormatclass to format the message. It can be null.
-
getMessage
public String getMessage()
Gets messages of the exceptions including the nested exceptions.- Specified by:
getMessagein interfaceL10NMessage- Overrides:
getMessagein classThrowable- Returns:
- messages of the exceptions including nested exceptions. The returned string is formed by concatenating messages of all the exceptions, with a new line separator, starting from this exception, all the way to the root exception, by following the nested exceptions. The message returned is always in English locale. To get localized message, use the getL10NMessage(Locale) method.
-
-