diff options
author | Huahui Wu <hwu@google.com> | 2011-06-28 10:17:45 -0700 |
---|---|---|
committer | Huahui Wu <hwu@google.com> | 2011-06-28 12:32:56 -0700 |
commit | 5bb9b19c5a3f3cf292f812ff5b9f9b8bcc88e5af (patch) | |
tree | 949b5eb9cdd8cddc1f1201e24a886dcad8b3fb3b /core/java/android/net/http | |
parent | ad13897a409183d299cd915ca0b3470c454faca5 (diff) | |
download | frameworks_base-5bb9b19c5a3f3cf292f812ff5b9f9b8bcc88e5af.zip frameworks_base-5bb9b19c5a3f3cf292f812ff5b9f9b8bcc88e5af.tar.gz frameworks_base-5bb9b19c5a3f3cf292f812ff5b9f9b8bcc88e5af.tar.bz2 |
2nd try: Gets the URL that has a cert error and carrys it in SslError.
Identical to https://android-git.corp.google.com/g/#change,117828
which was reverted since its collaborative CL broke the build.
Change-Id: I5fa7d3e9b6026639bf72530ff5b449e36f802914
Diffstat (limited to 'core/java/android/net/http')
-rw-r--r-- | core/java/android/net/http/SslError.java | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/core/java/android/net/http/SslError.java b/core/java/android/net/http/SslError.java index e1b9deb..1e1cb49 100644 --- a/core/java/android/net/http/SslError.java +++ b/core/java/android/net/http/SslError.java @@ -59,36 +59,97 @@ public class SslError { /** * The SSL certificate associated with the error set */ - SslCertificate mCertificate; + final SslCertificate mCertificate; + + /** + * The URL associated with the error set. + */ + final String mUrl; /** * Creates a new SSL error set object * @param error The SSL error * @param certificate The associated SSL certificate + * @deprecated Use {@link #SslError(int, SslCertificate, String)} */ + @Deprecated public SslError(int error, SslCertificate certificate) { addError(error); + if (certificate == null) { + throw new NullPointerException("certificate is null."); + } mCertificate = certificate; + mUrl = ""; } /** * Creates a new SSL error set object * @param error The SSL error * @param certificate The associated SSL certificate + * @deprecated Use {@link #SslError(int, X509Certificate, String)} */ + @Deprecated public SslError(int error, X509Certificate certificate) { addError(error); + if (certificate == null) { + throw new NullPointerException("certificate is null."); + } mCertificate = new SslCertificate(certificate); + mUrl = ""; } /** - * @return The SSL certificate associated with the error set + * Creates a new SSL error set object + * @param error The SSL error + * @param certificate The associated SSL certificate + * @param url The associated URL. + */ + public SslError(int error, SslCertificate certificate, String url) { + addError(error); + if (certificate == null) { + throw new NullPointerException("certificate is null."); + } + mCertificate = certificate; + if (url == null) { + throw new NullPointerException("url is null."); + } + mUrl = url; + } + + /** + * Creates a new SSL error set object + * @param error The SSL error + * @param certificate The associated SSL certificate + * @param url The associated URL. + */ + public SslError(int error, X509Certificate certificate, String url) { + addError(error); + if (certificate == null) { + throw new NullPointerException("certificate is null."); + } + mCertificate = new SslCertificate(certificate); + if (url == null) { + throw new NullPointerException("url is null."); + } + mUrl = url; + } + + /** + * @return The SSL certificate associated with the error set, non-null. */ public SslCertificate getCertificate() { return mCertificate; } /** + * @return The URL associated with the error set, non-null. + * "" if one of the deprecated constructors is used. + */ + public String getUrl() { + return mUrl; + } + + /** * 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 @@ -137,6 +198,7 @@ public class SslError { */ public String toString() { return "primary error: " + getPrimaryError() + - " certificate: " + getCertificate(); + " certificate: " + getCertificate() + + " on URL: " + getUrl(); } } |