Previous Topic: Session ClassNext Topic: Exception Class


Result Class

The Result class, SmApiResult, stores the result of a SiteMinder Java API request. A SiteMinder result contains the following elements:

A result might also include a reason code. For example, a password policy result might include a reason code of 1001, meaning that the password does not contain the required minimum number of characters. To find a reason code for a result, call getReason().

All server-side errors are returned as results, not as exceptions. However, when a client-side exception is thrown, an SmApiResult object is embedded in the exception.

Interpret a Result Object

Each result object and its Facility/Severity/Status combination are represented by a unique value. These unique values are associated with predefined constants defined in the SmApiResult class—for example, SERVER_CONFIGURATION_FAILURE.

To determine the Facility/Severity/Status information for a result, you can call the equals() method to compare the returned SmApiResult object with the result constants.

You can output a result object as a string—for example, you can generate a result string by calling toString() on the SmApiResult object.

A result string has five space-separated name/value pairs in the following format:

[facility=facility severity=severity reason=reason
status=statusCode message=message]

For example, suppose you call toString() for an SmApiResult object that occurs because a user attempted to create a password with fewer than the minimum number of alphabetic characters. The method might return a result string that looks like this:

[facility=4 severity=3 reason=1008 status=13 message=nArg=1,Arg1=3]

The fields in the result have the following meanings:

Core Methods in the Result Class

The core methods of the SmApiResult class include:

Method

Description

equals()

Indicates whether the current object is equal to the object passed to the method.

getError()

Retrieves a unique error code.

getFacility()

Retrieves the facility code associated with the error.

getMessage()

Retrieves the message associated with the error.

getReason()

Retrieves the reason code of the error.

getSeverity()

Retrieves the severity code associated with the error.

getStatus()

Retrieves the status code in the current facility. This method can take as a parameter the result code from the server.

isSuccess()

Reports whether the request was successful.

toString()

Returns a string representation of the SmApiResult object.