FileDocCategorySizeDatePackage
UserCredentialManagerException.javaAPI DocphoneME MR2 API (J2ME)3866Wed May 02 18:00:38 BST 2007javax.microedition.pki

UserCredentialManagerException

public final class UserCredentialManagerException extends Exception
This class is used to identify error conditions in the management of the user certificate store. Thrown by the CMSMessageSignatureService and UserCredentialManager classes.

Fields Summary
public static final byte
CREDENTIAL_NOT_SAVED
Code returned if a credential can not be added. For example, it is returned if there is insufficient memory to add additional credentials
public static final byte
SE_NO_KEYGEN
Code returned if a security element does not support key generation.
public static final byte
SE_NO_KEYS
Code returned if a security element does not have keys available for certificate requests.
public static final byte
SE_NO_UNASSOCIATED_KEYS
Code returned if a security element does not have any keys available that are not already associated with a certificate, and if the platform does not allow reuse of keys that are associated with an existing certificate.
public static final byte
SE_NOT_FOUND
Code returned if an appropriate security element can not be found.
public static final byte
CREDENTIAL_NOT_FOUND
Code returned if an appropriate certificate can not be found.
private byte
reasonCode
The reason code for exception.
Constructors Summary
public UserCredentialManagerException(byte code)
Construct an exception with specific reason code.

param
code the code for the error condition


                         
       
        super(getMessageForReason(code));
	reasonCode = code;
    
Methods Summary
static java.lang.StringgetMessageForReason(int reason)
Gets the exception message for a reason.

param
reason reason code
return
exception message

        switch (reason) {
        case CREDENTIAL_NOT_SAVED:
            return "Could not save credential";
        case SE_NO_KEYGEN:
            return "Security element does not support key generation";
        case SE_NO_KEYS:
            return "Security Element has no keys";
        case SE_NO_UNASSOCIATED_KEYS:
            return "Security Element has no unassociated keys";
        case SE_NOT_FOUND:
            return "Security Element was not found";
        case CREDENTIAL_NOT_FOUND:
            return "Credential was not found";
        }

        return "Unknown reason (" + reason + ")";
    
public bytegetReason()
Gets the reason code.

return
the code for the error condition

        return reasonCode;