com.sun.identity.authentication.spi
Class AuthLoginException

com.sun.identity.authentication.spi.AuthLoginException
Direct Known Subclasses:
InvalidPasswordException

public class AuthLoginException

This class is for handling message localization in LoginException.


Constructor Summary
AuthLoginException(java.lang.String message)
          Constructor.
AuthLoginException(java.lang.String rbName, java.lang.String errorCode, java.lang.Object[] args)
          Constructs a new AuthLoginException without a nested throwable.
AuthLoginException(java.lang.String rbName, java.lang.String errorCode, java.lang.Object[] args, java.lang.Throwable nestedException)
          Constructs an instance of AuthLoginException 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.
AuthLoginException(java.lang.Throwable nestedException)
          Constructs an AuthLoginExcetpion with given throwable.
 
Method Summary
 java.lang.String getErrorCode()
          Returns the error code.
 java.lang.String getL10NMessage(java.util.Locale locale)
          Returns the localized message of the given locale.
 java.lang.String getMessage()
          Gets messages of the exceptions including the nested exceptions.
 java.lang.Object[] getMessageArgs()
          Returns the error message arguments.
 java.lang.String getResourceBundleName()
          Returns the resource bundle name.
 void printStackTrace()
          Prints the stack trace of the root exception to standard error stream.
 void printStackTrace(java.io.PrintStream ps)
          Prints the stack trace of the root exception to a PrintStream Also prints the messages of all the exceptions starting from top exception to the root exception, at the top of stack trace
 void printStackTrace(java.io.PrintWriter pw)
          Prints the stack trace of the root exception to a PrintWriter Also prints the messages of all the exceptions starting from top exception to the root exception, at the top of stack trace
 

Constructor Detail

AuthLoginException

public AuthLoginException(java.lang.Throwable nestedException)
Constructs an AuthLoginExcetpion with given throwable.
Parameters:
nestedException - Exception nested in the new exception.

AuthLoginException

public AuthLoginException(java.lang.String message)
Constructor. Constructs a new AuthLoginException with the given message.
Parameters:
message - message for this exception. This message can be later retrieved by getMessage() method.

AuthLoginException

public AuthLoginException(java.lang.String rbName,
                          java.lang.String errorCode,
                          java.lang.Object[] args,
                          java.lang.Throwable nestedException)
Constructs an instance of AuthLoginException 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 consistent with current JRE
Parameters:
rbName - - ResourceBundle Name to be used for getting localized error message.
errorCode - - Key to resource bundle. You can use ResourceBundle rb = ResourceBunde.getBundle (rbName,locale); String localizedStr = rb.getString(errorCode)
args - - arguments to message. If it is not present pass them as null
nestedException - - The nested throwable.

AuthLoginException

public AuthLoginException(java.lang.String rbName,
                          java.lang.String errorCode,
                          java.lang.Object[] args)
Constructs a new AuthLoginException without a nested throwable.
Parameters:
rbName - - ResourceBundle Name to be used for getting localized error message.
errorCode - - Key to resource bundle. You can use ResourceBundle 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 java.lang.String getL10NMessage(java.util.Locale locale)
Returns the localized message of the given locale.
Parameters:
locale - the locale in which the message will be returned.
Returns:
String localized error message

getResourceBundleName

public java.lang.String getResourceBundleName()
Returns the resource bundle name.
Returns:
ResourceBundle Name associated with this error message.
See Also:
getL10NMessage(java.util.Locale)

getErrorCode

public java.lang.String getErrorCode()
Returns the error code.
Returns:
Error code associated with this error message.

getMessageArgs

public java.lang.Object[] getMessageArgs()
Returns the error message arguments.
Returns:
arguments for formatting this error message. You need to use MessageFormat class to format the message. It can be null.

getMessage

public java.lang.String getMessage()
Gets messages of the exceptions including the nested exceptions.
Returns:
messages of the exceptions including nested exceptions. The returned string is formed by contatnating 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 messsage returned is always in English locale. To get localized message, use the getL10NMessage(Locale) method.

printStackTrace

public void printStackTrace()
Prints the stack trace of the root exception to standard error stream. Also prints the messages of all the exceptions starting from top exception to the root exception, at the top of stack trace

printStackTrace

public void printStackTrace(java.io.PrintWriter pw)
Prints the stack trace of the root exception to a PrintWriter Also prints the messages of all the exceptions starting from top exception to the root exception, at the top of stack trace
Parameters:
pw - PrintWriter to which to print the stack trace

printStackTrace

public void printStackTrace(java.io.PrintStream ps)
Prints the stack trace of the root exception to a PrintStream Also prints the messages of all the exceptions starting from top exception to the root exception, at the top of stack trace
Parameters:
ps - PrintStream to which to print the stack trace