FileDocCategorySizeDatePackage
PaymentException.javaAPI DocphoneME MR2 API (J2ME)13124Wed May 02 18:00:44 BST 2007com.sun.j2me.payment

PaymentException

public class PaymentException extends Exception
Thrown when validating MIDlet's payment information or when downloading and validating a payment update file (JPP).
version
1.2

Fields Summary
public static final int
UNSUPPORTED_PAYMENT_INFO
The payment information has an unsupported version. The getParam() method returns the number of this version.
public static final int
MISSING_MANDATORY_ATTRIBUTE
The payment information doesn't contain a mandatory attribute. The getParam() method returns the name of the attribute.
public static final int
INVALID_ATTRIBUTE_VALUE
The payment information contains an attribute with an invalid value. The getParam() method returns the name of the attribute.
public static final int
UNSUPPORTED_ADAPTERS
The device doesn't support any of the adapters listed in the payment information file. The getParam() method returns the name of the attribute which contains the adapter names.
public static final int
UNSUPPORTED_PROVIDERS
The device doesn't support any of the adapters listed in the payment information file. The getParam() method returns the name of the attribute which contains the provider names.
public static final int
UNSUPPORTED_URL_SCHEME
The device doesn't support the scheme of the update URL. The getParam() method returns the update URL.
public static final int
INFORMATION_NOT_YET_VALID
The payment information is not yet valid.
public static final int
INFORMATION_EXPIRED
The payment information has been expired.
public static final int
INCOMPLETE_INFORMATION
The payment information is incomplete.
public static final int
INVALID_ADAPTER_CONFIGURATION
The payment information contains an invalid PaymentSpecificInformation field. The getParam() method returns the name of the attribute which contains the invalid field.
public static final int
INVALID_PRICE_INFORMATION
The payment information contains an invalid PaymentSpecificPrice- Information field. The getParam() method returns the name of the attribute which contains the invalid field.
public static final int
INVALID_UPDATE_URL
The payment update failed because the update URL is invalid. The getParam() method returns the URL.
public static final int
UPDATE_SERVER_NOT_FOUND
The update server has been not found. The getParam() method returns the URL of the payment update file.
public static final int
UPDATE_NOT_FOUND
The payment update file has not been found on the server. The getParam() method returns the URL of the payment update file.
public static final int
UPDATE_SERVER_BUSY
The update server is busy.
public static final int
UPDATE_REQUEST_ERROR
The http request failed. The getParam() method returns the HTTP response code.
public static final int
INVALID_UPDATE_TYPE
The payment update file has an invalid or missing MIME-type. The getParam() method returns this type.
public static final int
UNSUPPORTED_UPDATE_CHARSET
The payment update file has an unsupported character set. The getParam() method returns the character set name.
public static final int
EXPIRED_PROVIDER_CERT
The provider's certificate has expired or is not yet valid. The getParam() method returns the subject name of the certificate.
public static final int
EXPIRED_CA_CERT
The public key of the provider's root CA has expired. The getParam() method returns the subject name of the CA certificate.
public static final int
INVALID_PROVIDER_CERT
The provider's certificate is invalid. The getParam() method returns the subject name of the certificate.
public static final int
NO_TRUSTED_CHAIN
The payment update file does not contain any certification chain which can be verified.
public static final int
SIGNATURE_VERIFICATION_FAILED
The verification of the payment update file's signature has failed.
public static final int
INVALID_PROPERTIES_FORMAT
The payment update file has an invalid properties file format.
private int
reason
private String
param
Constructors Summary
public PaymentException(int reason)
Creates an instance of the PaymentException class with the given reason.

param
reason the reason


                         
       
        this.reason = reason;
    
public PaymentException(int reason, String detail)
Creates an instance of the PaymentException class with the given reason and the detail message.

param
reason the reason
param
detail the detail message

        super(detail);
        this.reason = reason;
    
public PaymentException(int reason, String param, String detail)
Creates an instance of the PaymentException class with the given reason, an additional string value which meaning depends on the reason and the detail message.

param
reason the reason
param
param the string value
param
detail the detail message

        super(detail);
        this.reason = reason;
        this.param = param;
    
Methods Summary
public final java.lang.StringgetDetail()
Returns the detail message for the exception.

return
the detail message

        return super.getMessage();
    
public final java.lang.StringgetMessage()
Returns the full description of the exception. It uses the reason code, the param value and the detail message to construct the description.

return
the full description of the exception

        String message;
        
        switch (reason) {
            case UNSUPPORTED_PAYMENT_INFO:
                message = "Unsupported version of the payment information (" + 
                        param + ")";
                break;
            case MISSING_MANDATORY_ATTRIBUTE:
                message = "The required " + param + " attribute is missing";
                break;
            case INVALID_ATTRIBUTE_VALUE:
                message = "The " + param + " attribute contains an " +
                        "invalid value";
                if (super.getMessage() != null) {
                    message += " (" + super.getMessage() + ")";
                }
                break;
            case UNSUPPORTED_ADAPTERS:
                message = "None of the adapters is supported (" 
                        + param + ")";
                break;
            case UNSUPPORTED_PROVIDERS:
                message = "None of the providers is supported (" 
                        + param + ")";
                break;
            case UNSUPPORTED_URL_SCHEME:
                message = "The update URL has an unsupported scheme (" 
                        + param + ")";
                break;
            case INFORMATION_NOT_YET_VALID:
                message = "Payment information is not yet valid";
                break;
            case INFORMATION_EXPIRED:
                message = "Payment information is expired";
                break;
            case INCOMPLETE_INFORMATION:
                message = "The payment information is incomplete";
                break;
            case INVALID_ADAPTER_CONFIGURATION:
                message = "The " + param + " attribute contains an " +
                        "invalid adapter configuration string";
                if (super.getMessage() != null) {
                    message += " (" + super.getMessage() + ")";
                }
                break;
            case INVALID_PRICE_INFORMATION:
                message = "The " + param + " attribute contains " +
                        "invalid payment specific price information";
                if (super.getMessage() != null) {
                    message += " (" + super.getMessage() + ")";
                }
                break;
            case INVALID_UPDATE_URL:
                message = "The update URL " + param + " is invalid";
                break;
            case UPDATE_SERVER_NOT_FOUND:
                message = "The server for the payment update was not found " +
                        "at the URL " + param;
                break;
            case UPDATE_NOT_FOUND:
                message = "The payment update file was not found at the URL " +
                        param;
                break;
            case UPDATE_SERVER_BUSY:
                message = "The payment update server is busy";
                break;
            case UPDATE_REQUEST_ERROR:
                message = "The payment update request has been denied by the " +
                        "update server (HTTP response code = " + param + ")";
                break;
            case INVALID_UPDATE_TYPE:
                message = "The payment update file has a missing or " +
                        "incorrect type (" + param + ")";
                break;
            case UNSUPPORTED_UPDATE_CHARSET:
                message = "The payment update file is in an unsupported " +
                        "character set (" + param + ")";
                break;
            case EXPIRED_PROVIDER_CERT:
                message = "The provider certificate (" + param + ") is " +
                        "expired or not yet valid";
                break;
            case EXPIRED_CA_CERT:
                message = "The root CA's public key expired (" + param + ")";
                break;
            case INVALID_PROVIDER_CERT:
                message = "The provider certificate (" + param + ") is " +
                        "invalid or unsupported";
                break;
            case NO_TRUSTED_CHAIN:
                message = "Can't verify any provider certificate";
                break;
            case SIGNATURE_VERIFICATION_FAILED:
                message = "Verification of the payment update signature failed";
                break;
            case INVALID_PROPERTIES_FORMAT:
                message = "The payment update file is not a valid properties " +
                        "file";
                if (super.getMessage() != null) {
                    message += " (" + super.getMessage() + ")";
                }
                break;
            default:
                message = super.getMessage();
                break;
        }
        
        return message;
    
public final java.lang.StringgetParam()
Returns an additional string value which depends on the reason for the exception.

return
the string value
see
#setParam

        return param;        
    
public final intgetReason()
Returns the reason for the exception as a number.

return
the reason

        return reason;
    
public final voidsetParam(java.lang.String param)
Sets an additional string value which depends on the reason for the exception.

param
param the string value
see
#getParam

        this.param = param;