FileDocCategorySizeDatePackage
SslError.javaAPI DocAndroid 1.5 API3864Wed May 06 22:41:56 BST 2009android.net.http

SslError

public class SslError extends Object
One or more individual SSL errors and the associated SSL certificate {@hide}

Fields Summary
public static final int
SSL_NOTYETVALID
The certificate is not yet valid
public static final int
SSL_EXPIRED
The certificate has expired
public static final int
SSL_IDMISMATCH
Hostname mismatch
public static final int
SSL_UNTRUSTED
The certificate authority is not trusted
public static final int
SSL_MAX_ERROR
The number of different SSL errors (update if you add a new SSL error!!!)
int
mErrors
The SSL error set bitfield (each individual error is an bit index; multiple individual errors can be OR-ed)
SslCertificate
mCertificate
The SSL certificate associated with the error set
Constructors Summary
public SslError(int error, SslCertificate certificate)
Creates a new SSL error set object

param
error The SSL error
param
certificate The associated SSL certificate


                           
         
        addError(error);
        mCertificate = certificate;
    
public SslError(int error, X509Certificate certificate)
Creates a new SSL error set object

param
error The SSL error
param
certificate The associated SSL certificate

        addError(error);
        mCertificate = new SslCertificate(certificate);
    
Methods Summary
public booleanaddError(int error)
Adds the SSL error to the error set

param
error The SSL error to add
return
True iff the error being added is a known SSL error

        boolean rval = (0 <= error && error < SslError.SSL_MAX_ERROR);
        if (rval) {
            mErrors |= (0x1 << error);
        }

        return rval;
    
public SslCertificategetCertificate()

return
The SSL certificate associated with the error set

        return mCertificate;
    
public intgetPrimaryError()

return
The primary, most severe, SSL error in the set

        if (mErrors != 0) {
            // go from the most to the least severe errors
            for (int error = SslError.SSL_MAX_ERROR - 1; error >= 0; --error) {
                if ((mErrors & (0x1 << error)) != 0) {
                    return error;
                }
            }
        }

        return 0;
    
public booleanhasError(int error)

param
error The SSL error to check
return
True iff the set includes the error

        boolean rval = (0 <= error && error < SslError.SSL_MAX_ERROR);
        if (rval) {
            rval = ((mErrors & (0x1 << error)) != 0);
        }

        return rval;
    
public java.lang.StringtoString()

return
A String representation of this SSL error object (used mostly for debugging).

        return "primary error: " + getPrimaryError() +
            " certificate: " + getCertificate();