Package com.sun.identity.policy
Class PolicyException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.sun.identity.policy.PolicyException
-
- All Implemented Interfaces:
L10NMessage
,Serializable
- Direct Known Subclasses:
InvalidAppSSOTokenException
,InvalidFormatException
,InvalidNameException
,LimitExceededException
,NameAlreadyExistsException
,NameNotFoundException
,NoPermissionException
,ObjectInUseException
,PolicyEvaluationException
public class PolicyException extends Exception
The classPolicyException
is the basic exception for the the policy component. All other exceptions in this package are derived from this exception.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
CONDITION_COLLECTION
The constant variable specifies the exception is with respect to constraint collection.static int
ORGANIZATION
The constant variable specifies the exception is with respect to organization, sub-organization or the container.static int
POLICY
The constant variable specifies the exception is with respect to policy.static int
REFERRAL_COLLECTION
The constant variable specifies the exception is with respect to referral collection.static int
REFERRAL_TYPE
The constant variable specifies the exception is with respect to Referral Typestatic int
RESPONSE_PROVIDER_COLLECTION
The constant variable specifies the exception is with respect to response provider collection.static int
RULE
The constant variable specifies the exception is with respect to rule.static int
SERVICE
The constant variable specifies the exception is with respect to services.static int
SUBJECT_TYPE
The constant variable specifies the exception is with respect to Subject Typestatic int
USER_COLLECTION
The constant variable specifies the exception is with respect to user collection.
-
Constructor Summary
Constructors Constructor Description PolicyException(String message)
Constructs an instance of thePolicyException
class.PolicyException(String rbName, String errorCode, Object[] args, Throwable nestedException)
Constructs an instance ofPolicyException
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.PolicyException(String message, Throwable nestedException)
Constructs an instance of thePolicyException
class.PolicyException(Throwable nestedException)
Constructs an instance of thePolicyException
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCompleteL10NMessage(Locale locale)
String
getErrorCode()
Use this method to chain this exception with another to get localized error messge use getL10NMessage methodString
getL10NMessage(Locale locale)
Use this method to get localized error message directly.String
getMessage()
Gets messages of the exceptions including the chained exceptionsObject[]
getMessageArgs()
Use this method to chain this exception with another to get localized error messge use getL10NMessage methodThrowable
getNestedException()
String
getResourceBundleName()
Use this method to chain this exception with another to get localized error messge use getL10NMessage methodvoid
printStackTrace()
Prints the stack trace of the root exception to standard error stream.void
printStackTrace(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 tracevoid
printStackTrace(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-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, setStackTrace, toString
-
-
-
-
Field Detail
-
POLICY
public static final int POLICY
The constant variable specifies the exception is with respect to policy.- See Also:
- Constant Field Values
-
RULE
public static final int RULE
The constant variable specifies the exception is with respect to rule.- See Also:
- Constant Field Values
-
SERVICE
public static final int SERVICE
The constant variable specifies the exception is with respect to services.- See Also:
- Constant Field Values
-
ORGANIZATION
public static final int ORGANIZATION
The constant variable specifies the exception is with respect to organization, sub-organization or the container.- See Also:
- Constant Field Values
-
USER_COLLECTION
public static final int USER_COLLECTION
The constant variable specifies the exception is with respect to user collection.- See Also:
- Constant Field Values
-
CONDITION_COLLECTION
public static final int CONDITION_COLLECTION
The constant variable specifies the exception is with respect to constraint collection.- See Also:
- Constant Field Values
-
RESPONSE_PROVIDER_COLLECTION
public static final int RESPONSE_PROVIDER_COLLECTION
The constant variable specifies the exception is with respect to response provider collection.- See Also:
- Constant Field Values
-
REFERRAL_COLLECTION
public static final int REFERRAL_COLLECTION
The constant variable specifies the exception is with respect to referral collection.- See Also:
- Constant Field Values
-
REFERRAL_TYPE
public static final int REFERRAL_TYPE
The constant variable specifies the exception is with respect to Referral Type- See Also:
- Constant Field Values
-
SUBJECT_TYPE
public static final int SUBJECT_TYPE
The constant variable specifies the exception is with respect to Subject Type- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PolicyException
public PolicyException(String message)
Constructs an instance of thePolicyException
class.- Parameters:
message
- The message provided by the object that is throwing the exception.
-
PolicyException
public PolicyException(Throwable nestedException)
Constructs an instance of thePolicyException
class.- Parameters:
nestedException
- the exception caught by the code block creating this exception
-
PolicyException
public PolicyException(String message, Throwable nestedException)
Constructs an instance of thePolicyException
class.- Parameters:
message
- message of this exceptionnestedException
- the exception caught by the code block creating this exception
-
PolicyException
public PolicyException(String rbName, String errorCode, Object[] args, Throwable nestedException)
Constructs an instance ofPolicyException
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 nullnestedException
- The root cause of this error
-
-
Method Detail
-
getL10NMessage
public String getL10NMessage(Locale locale)
Description copied from interface:L10NMessage
Use this method to get localized error message directly.- Specified by:
getL10NMessage
in interfaceL10NMessage
- Parameters:
locale
-Locale
to be used.- Returns:
- String localized error message.
- See Also:
ChainedException(String, String, Object[], Throwable)
-
getCompleteL10NMessage
public String getCompleteL10NMessage(Locale locale)
- Parameters:
locale
-Locale
to be used.- Returns:
- String localized error message.
- See Also:
ChainedException(String, String, Object[], Throwable)
-
getResourceBundleName
public String getResourceBundleName()
Description copied from interface:L10NMessage
Use this method to chain this exception with another to get localized error messge use getL10NMessage method- Specified by:
getResourceBundleName
in interfaceL10NMessage
- Returns:
- ResourceBundle Name associated with this error message.
- See Also:
ChainedException(String, String, Object[], Throwable)
,- to get localized error message.
-
getErrorCode
public String getErrorCode()
Description copied from interface:L10NMessage
Use this method to chain this exception with another to get localized error messge use getL10NMessage method- Specified by:
getErrorCode
in interfaceL10NMessage
- Returns:
- Error code associated with this error message.
- See Also:
ChainedException(String, String, Object[], Throwable)
,- to get localized error message.
-
getMessageArgs
public Object[] getMessageArgs()
Description copied from interface:L10NMessage
Use this method to chain this exception with another to get localized error messge use getL10NMessage method- 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:
ChainedException(String, String, Object[], Throwable)
,- to get localized error message.
-
getMessage
public String getMessage()
Gets messages of the exceptions including the chained exceptions- Specified by:
getMessage
in interfaceL10NMessage
- Overrides:
getMessage
in classThrowable
- Returns:
- messages of the exceptions including chained 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 chained exceptions.
-
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- Overrides:
printStackTrace
in classThrowable
-
printStackTrace
public void printStackTrace(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- Overrides:
printStackTrace
in classThrowable
- Parameters:
pw
- PrintWriter to which to print the stack trace
-
printStackTrace
public void printStackTrace(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- Overrides:
printStackTrace
in classThrowable
- Parameters:
ps
- PrintStream to which to print the stack trace
-
getNestedException
public Throwable getNestedException()
-
-