Package com.sun.identity.sm
Class SMSException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.sun.identity.sm.SMSException
-
- All Implemented Interfaces:
L10NMessage
,Serializable
- Direct Known Subclasses:
InvalidAttributeNameException
,InvalidAttributeValueException
,OrganizationAlreadyExistsException
,SchemaException
,ServiceAlreadyExistsException
,ServiceNotFoundException
public class SMSException extends Exception implements L10NMessage
The exception class whose instance is thrown if there is any error during the operation of objects of thecom.sun.identity.sms
package. This class maps the exception that occurred at a lower level to a high level error. Using the exception status codegetExceptionCode()
the errors are categorized as aABORT
,RETRY
,CONFIG_PROBLEM
orLDAP_OP_FAILED
(typically a bug).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
STATUS_ABORT
Status to abort operationstatic int
STATUS_CONFIG_PROBLEM
If the root LDAP exception isINVALID_CREDENTIALS
orREFERRAL
then this status is setstatic int
STATUS_LDAP_OP_FAILED
If root LDAP cause is an LDAP exception with one of the following error codes then this status is set.static int
STATUS_NO_PERMISSION
If the root LDAP cause isINSUFFICIENT_ACCESS_RIGHTS
static int
STATUS_NONE
No status code is setstatic int
STATUS_NOT_ALLOW
the operation is not allowed.static int
STATUS_QUO_ANTE
If root LDAP cause isLDAP_PARTIAL_RESULTS
then this status is setstatic int
STATUS_REPEATEDLY_FAILED
Repeated retry to data store failedstatic int
STATUS_RETRY
Retry connection to data storestatic int
STATUS_UNKNOWN_EXCEPTION
If root cause is other than any of those listed in other status codes
-
Constructor Summary
Constructors Constructor Description SMSException()
Default constructor forSMSException
SMSException(int status, String errorCode)
SMSException(int status, String exMessage, String errorCode)
SMSException(String msg)
SMSException(String msg, String errorCode)
SMSException(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.SMSException(String rbName, String message, Throwable t, String errorCode)
Constructs anSMSException
.SMSException(String message, Throwable t, String errorCode)
Constructs anSMSException
.SMSException(Throwable t, String errorCode)
Constructs anSMSException
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getErrorCode()
Returns error code associated with this error message.int
getExceptionCode()
Returns the status code for this exception.String
getL10NMessage(Locale locale)
Returns a localized error messageString
getMessage()
Returns the error message of this exception.Object[]
getMessageArgs()
Returns arguments for formatting this error message.String
getResourceBundleName()
ReturnsResourceBundle
Name associated with this error message.String
toString()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Field Detail
-
STATUS_NONE
public static final int STATUS_NONE
No status code is set- See Also:
- Constant Field Values
-
STATUS_RETRY
public static final int STATUS_RETRY
Retry connection to data store- See Also:
- Constant Field Values
-
STATUS_REPEATEDLY_FAILED
public static final int STATUS_REPEATEDLY_FAILED
Repeated retry to data store failed- See Also:
- Constant Field Values
-
STATUS_ABORT
public static final int STATUS_ABORT
Status to abort operation- See Also:
- Constant Field Values
-
STATUS_QUO_ANTE
public static final int STATUS_QUO_ANTE
If root LDAP cause isLDAP_PARTIAL_RESULTS
then this status is set- See Also:
- Constant Field Values
-
STATUS_LDAP_OP_FAILED
public static final int STATUS_LDAP_OP_FAILED
If root LDAP cause is an LDAP exception with one of the following error codes then this status is set.NO_SUCH_OBJECT OBJECT_CLASS_VIOLATION NAMING_VIOLATION CONSTRAINT_VIOLATION INVALID_DN_SYNTAX ENTRY_ALREADY_EXISTS ATTRIBUTE_OR_VALUE_EXISTS PROTOCOL_ERROR UNDEFINED_ATTRIBUTE_TYPE
- See Also:
- Constant Field Values
-
STATUS_CONFIG_PROBLEM
public static final int STATUS_CONFIG_PROBLEM
If the root LDAP exception isINVALID_CREDENTIALS
orREFERRAL
then this status is set- See Also:
- Constant Field Values
-
STATUS_UNKNOWN_EXCEPTION
public static final int STATUS_UNKNOWN_EXCEPTION
If root cause is other than any of those listed in other status codes- See Also:
- Constant Field Values
-
STATUS_NO_PERMISSION
public static final int STATUS_NO_PERMISSION
If the root LDAP cause isINSUFFICIENT_ACCESS_RIGHTS
- See Also:
- Constant Field Values
-
STATUS_NOT_ALLOW
public static final int STATUS_NOT_ALLOW
the operation is not allowed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SMSException
public SMSException()
Default constructor forSMSException
-
SMSException
public SMSException(int status, String errorCode)
- Parameters:
status
- The exception status code.errorCode
- Key to resource bundle.
-
SMSException
public SMSException(int status, String exMessage, String errorCode)
- Parameters:
status
- The Exception status code.exMessage
- The message provided by the object which is throwing the exceptionerrorCode
- Key to resource bundle.
-
SMSException
public SMSException(String msg)
- Parameters:
msg
- The message provided by the object which is throwing the exception
-
SMSException
public SMSException(String msg, String errorCode)
- Parameters:
msg
- The message provided by the object which is throwing the exceptionerrorCode
- Key to resource bundle.
-
SMSException
public SMSException(Throwable t, String errorCode)
Constructs anSMSException
.- Parameters:
t
- TheThrowable
object provided by the object which is throwing the exceptionerrorCode
- Key to resource bundle.
-
SMSException
public SMSException(String message, Throwable t, String errorCode)
Constructs anSMSException
.- Parameters:
message
- exception message.t
- TheThrowable
object provided by the object which is throwing the exception.errorCode
- Key to resource bundle.
-
SMSException
public SMSException(String rbName, String message, Throwable t, String errorCode)
Constructs anSMSException
.- Parameters:
rbName
- Resource bundle Name to be used for getting localized error message.message
- exception message.t
- TheThrowable
object provided by the object which is throwing the exception.errorCode
- Key to resource bundle.
-
SMSException
public SMSException(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 error code for correctly locating the error message. The defaultgetMessage()
will always return English messages only. This is in 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 the as null.
-
-
Method Detail
-
getL10NMessage
public String getL10NMessage(Locale locale)
Returns a localized error message- Specified by:
getL10NMessage
in interfaceL10NMessage
- Parameters:
locale
- Uses the locale object to create the appropriate localized error message- Returns:
- localized error message.
- See Also:
SMSException(String, String, Object[])
-
getResourceBundleName
public String getResourceBundleName()
ReturnsResourceBundle
Name associated with this error message.- Specified by:
getResourceBundleName
in interfaceL10NMessage
- Returns:
ResourceBundle
name associated with this error message.- See Also:
SMSException(String, String, Object[])
-
getErrorCode
public String getErrorCode()
Returns error code associated with this error message.- Specified by:
getErrorCode
in interfaceL10NMessage
- Returns:
- Error code associated with this error message.
- See Also:
SMSException(String, String, Object[])
-
getMessageArgs
public Object[] getMessageArgs()
Returns arguments for formatting this error message.- Specified by:
getMessageArgs
in interfaceL10NMessage
- Returns:
- arguments for formatting this error message. You need to use
MessageFormat
class to format the message It can be null. - See Also:
SMSException(String, String, Object[])
-
getExceptionCode
public int getExceptionCode()
Returns the status code for this exception.- Returns:
- Integer representing the exception status code
-
getMessage
public String getMessage()
Returns the error message of this exception.- Specified by:
getMessage
in interfaceL10NMessage
- Overrides:
getMessage
in classThrowable
- Returns:
- String representing the error message
-
-