Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/net/http/SslError#constants) \| [Ctors](https://developer.android.com/reference/android/net/http/SslError#pubctors) \| [Methods](https://developer.android.com/reference/android/net/http/SslError#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/http/SslError#inhmethods)

# SslError

*** ** * ** ***

` public class SslError `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.http.SslError |

<br />

*** ** * ** ***

This class represents a set of one or more SSL errors and the associated SSL certificate.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/net/http/SslError#SSL_DATE_INVALID` The date of the certificate is invalid |
| `int` | `https://developer.android.com/reference/android/net/http/SslError#SSL_EXPIRED` The certificate has expired |
| `int` | `https://developer.android.com/reference/android/net/http/SslError#SSL_IDMISMATCH` Hostname mismatch |
| `int` | `https://developer.android.com/reference/android/net/http/SslError#SSL_INVALID` A generic error occurred |
| `int` | `https://developer.android.com/reference/android/net/http/SslError#SSL_MAX_ERROR` *This constant was deprecated in API level 15. This constant is not necessary for using the SslError API and can change from release to release.* |
| `int` | `https://developer.android.com/reference/android/net/http/SslError#SSL_NOTYETVALID` The certificate is not yet valid |
| `int` | `https://developer.android.com/reference/android/net/http/SslError#SSL_UNTRUSTED` The certificate authority is not trusted |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/http/SslError#SslError(int,%20android.net.http.SslCertificate)(int error, https://developer.android.com/reference/android/net/http/SslCertificate certificate) ` *This constructor is deprecated. Use `https://developer.android.com/reference/android/net/http/SslError#SslError(int,%20android.net.http.SslCertificate,%20java.lang.String)`* |
| ` https://developer.android.com/reference/android/net/http/SslError#SslError(int,%20android.net.http.SslCertificate,%20java.lang.String)(int error, https://developer.android.com/reference/android/net/http/SslCertificate certificate, https://developer.android.com/reference/java/lang/String url) ` Creates a new SslError object using the supplied error, certificate and URL. |
| ` https://developer.android.com/reference/android/net/http/SslError#SslError(int,%20java.security.cert.X509Certificate)(int error, https://developer.android.com/reference/java/security/cert/X509Certificate certificate) ` *This constructor is deprecated. Use `https://developer.android.com/reference/android/net/http/SslError#SslError(int,%20java.security.cert.X509Certificate,%20java.lang.String)`* |
| ` https://developer.android.com/reference/android/net/http/SslError#SslError(int,%20java.security.cert.X509Certificate,%20java.lang.String)(int error, https://developer.android.com/reference/java/security/cert/X509Certificate certificate, https://developer.android.com/reference/java/lang/String url) ` Creates a new SslError object using the supplied error, certificate and URL. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/net/http/SslError#addError(int)(int error) ` Adds the supplied SSL error to the set. |
| ` https://developer.android.com/reference/android/net/http/SslCertificate` | ` https://developer.android.com/reference/android/net/http/SslError#getCertificate()() ` Gets the SSL certificate associated with this object. |
| ` int` | ` https://developer.android.com/reference/android/net/http/SslError#getPrimaryError()() ` Gets the most severe SSL error in this object's set of errors. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/net/http/SslError#getUrl()() ` Gets the URL associated with this object. |
| ` boolean` | ` https://developer.android.com/reference/android/net/http/SslError#hasError(int)(int error) ` Determines whether this object includes the supplied error. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/net/http/SslError#toString()() ` Returns a string representation of this object. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### SSL_DATE_INVALID

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SSL_DATE_INVALID
```

The date of the certificate is invalid

<br />

Constant Value: 4 (0x00000004)

### SSL_EXPIRED

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SSL_EXPIRED
```

The certificate has expired

<br />

Constant Value: 1 (0x00000001)

### SSL_IDMISMATCH

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SSL_IDMISMATCH
```

Hostname mismatch

<br />

Constant Value: 2 (0x00000002)

### SSL_INVALID

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SSL_INVALID
```

A generic error occurred

<br />

Constant Value: 5 (0x00000005)

### SSL_MAX_ERROR

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SSL_MAX_ERROR
```

<br />

**This constant was deprecated in API level 15.**   

This constant is not necessary for using the SslError API and can change from release to release.

The number of different SSL errors.

<br />

Constant Value: 6 (0x00000006)

### SSL_NOTYETVALID

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SSL_NOTYETVALID
```

The certificate is not yet valid

<br />

Constant Value: 0 (0x00000000)

### SSL_UNTRUSTED

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SSL_UNTRUSTED
```

The certificate authority is not trusted

<br />

Constant Value: 3 (0x00000003)

## Public constructors

### SslError

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslError (int error, 
                SslCertificate certificate)
```

<br />

**This constructor is deprecated.**   

Use `https://developer.android.com/reference/android/net/http/SslError#SslError(int,%20android.net.http.SslCertificate,%20java.lang.String)`

Creates a new SslError object using the supplied error and certificate. The URL will be set to the empty string.

<br />

| Parameters ||
|---|---|
| `error` | `int`: The SSL error <br /> |
| `certificate` | `SslCertificate`: The associated SSL certificate <br /> |

### SslError

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslError (int error, 
                SslCertificate certificate, 
                String url)
```

Creates a new SslError object using the supplied error, certificate and URL.

<br />

| Parameters ||
|---|---|
| `error` | `int`: The SSL error <br /> |
| `certificate` | `SslCertificate`: The associated SSL certificate <br /> |
| `url` | `String`: The associated URL <br /> |

### SslError

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslError (int error, 
                X509Certificate certificate)
```

<br />

**This constructor is deprecated.**   

Use `https://developer.android.com/reference/android/net/http/SslError#SslError(int,%20java.security.cert.X509Certificate,%20java.lang.String)`

Creates a new SslError object using the supplied error and certificate. The URL will be set to the empty string.

<br />

| Parameters ||
|---|---|
| `error` | `int`: The SSL error <br /> |
| `certificate` | `X509Certificate`: The associated SSL certificate <br /> |

### SslError

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslError (int error, 
                X509Certificate certificate, 
                String url)
```

Creates a new SslError object using the supplied error, certificate and URL.

<br />

| Parameters ||
|---|---|
| `error` | `int`: The SSL error <br /> |
| `certificate` | `X509Certificate`: The associated SSL certificate <br /> |
| `url` | `String`: The associated URL <br /> |

## Public methods

### addError

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean addError (int error)
```

Adds the supplied SSL error to the set.

<br />

| Parameters ||
|---|---|
| `error` | `int`: The SSL error to add <br /> |

| Returns ||
|---|---|
| `boolean` | True if the error being added is a known SSL error, otherwise false. <br /> |

### getCertificate

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslCertificate getCertificate ()
```

Gets the SSL certificate associated with this object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/SslCertificate` | The SSL certificate, non-null. <br /> |

### getPrimaryError

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getPrimaryError ()
```

Gets the most severe SSL error in this object's set of errors. Returns -1 if the set is empty.

<br />

| Returns ||
|---|---|
| `int` | The most severe SSL error, or -1 if the set is empty. <br /> |

### getUrl

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getUrl ()
```

Gets the URL associated with this object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The URL, non-null. <br /> |

### hasError

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasError (int error)
```

Determines whether this object includes the supplied error.

<br />

| Parameters ||
|---|---|
| `error` | `int`: The SSL error to check for <br /> |

| Returns ||
|---|---|
| `boolean` | True if this object includes the error, otherwise false. <br /> |

### toString

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of this object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A String representation of this object. <br /> |