# CertPathValidatorException

public class **CertPathValidatorException** extends [GeneralSecurityException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/GeneralSecurityException.html)  
An exception indicating one of a variety of problems encountered when
validating a certification path.


A `CertPathValidatorException` provides support for wrapping
exceptions. The `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getCause()` method returns the throwable,
if any, that caused this exception to be thrown.


A `CertPathValidatorException` may also include the
certification path that was being validated when the exception was thrown,
the index of the certificate in the certification path that caused the
exception to be thrown, and the reason that caused the failure. Use the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#getCertPath()`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#getIndex()`, and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#getReason()` methods to retrieve this information.


**Concurrent Access**


Unless otherwise specified, the methods defined in this class are not
thread-safe. Multiple threads that need to access a single
object concurrently should synchronize amongst themselves and
provide the necessary locking. Multiple threads each manipulating
separate objects need not synchronize.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidator.html`

### Nested Class Summary

|---|---|---|---|
| enum | [CertPathValidatorException.BasicReason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.BasicReason.html) || The BasicReason enumerates the potential reasons that a certification path of any type may be invalid. |
| interface | [CertPathValidatorException.Reason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.Reason.html) || The reason the validation algorithm failed. |

### Public Constructor Summary

|---|---|
|   | [CertPathValidatorException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#CertPathValidatorException())() Creates a `CertPathValidatorException` with no detail message. |
|   | [CertPathValidatorException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#CertPathValidatorException(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg) Creates a `CertPathValidatorException` with the given detail message. |
|   | [CertPathValidatorException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#CertPathValidatorException(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause) Creates a `CertPathValidatorException` that wraps the specified throwable. |
|   | [CertPathValidatorException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#CertPathValidatorException(java.lang.String,%20java.lang.Throwable))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause) Creates a `CertPathValidatorException` with the specified detail message and cause. |
|   | [CertPathValidatorException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#CertPathValidatorException(java.lang.String,%20java.lang.Throwable,%20java.security.cert.CertPath,%20int))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause, [CertPath](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPath.html) certPath, int index) Creates a `CertPathValidatorException` with the specified detail message, cause, certification path, and index. |
|   | [CertPathValidatorException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#CertPathValidatorException(java.lang.String,%20java.lang.Throwable,%20java.security.cert.CertPath,%20int,%20java.security.cert.CertPathValidatorException.Reason))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause, [CertPath](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPath.html) certPath, int index, [CertPathValidatorException.Reason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.Reason.html) reason) Creates a `CertPathValidatorException` with the specified detail message, cause, certification path, index, and reason. |

### Public Method Summary

|---|---|
| [CertPath](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPath.html) | [getCertPath](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#getCertPath())() Returns the certification path that was being validated when the exception was thrown. |
| int | [getIndex](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#getIndex())() Returns the index of the certificate in the certification path that caused the exception to be thrown. |
| [CertPathValidatorException.Reason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.Reason.html) | [getReason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#getReason())() Returns the reason that the validation failed. |

### Inherited Method Summary

From class [java.lang.Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)

|---|---|
| synchronized final void | [addSuppressed](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) exception) Appends the specified exception to the exceptions that were suppressed in order to deliver this exception. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [fillInStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#fillInStackTrace())() Fills in the execution stack trace. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getCause](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getCause())() Returns the cause of this throwable or `null` if the cause is nonexistent or unknown. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getLocalizedMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getLocalizedMessage())() Creates a localized description of this throwable. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getMessage())() Returns the detail message string of this throwable. |
| StackTraceElement\[\] | [getStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getStackTrace())() Provides programmatic access to the stack trace information printed by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace()`. |
| synchronized final [Throwable\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getSuppressed](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getSuppressed())() Returns an array containing all of the exceptions that were suppressed, typically by the `try`-with-resources statement, in order to deliver this exception. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [initCause](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#initCause(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause) Initializes the *cause* of this throwable to the specified value. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace())() Prints this throwable and its backtrace to the standard error stream. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintWriter))([PrintWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintWriter.html) s) Prints this throwable and its backtrace to the specified print writer. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintStream))([PrintStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintStream.html) s) Prints this throwable and its backtrace to the specified print stream. |
| void | [setStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[]))(StackTraceElement\[\] stackTrace) Sets the stack trace elements that will be returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getStackTrace()` and printed by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace()` and related methods. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#toString())() Returns a short description of this throwable. |

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**CertPathValidatorException**
()

Creates a `CertPathValidatorException` with
no detail message.

#### public
**CertPathValidatorException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg)

Creates a `CertPathValidatorException` with the given
detail message. A detail message is a `String` that
describes this particular exception.

##### Parameters

| msg | the detail message |
|---|---|

#### public
**CertPathValidatorException**
([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause)

Creates a `CertPathValidatorException` that wraps the
specified throwable. This allows any exception to be converted into a
`CertPathValidatorException`, while retaining information
about the wrapped exception, which may be useful for debugging. The
detail message is set to (`cause==null ? null : cause.toString()`)
(which typically contains the class and detail message of
cause).

##### Parameters

| cause | the cause (which is saved for later retrieval by the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getCause()` method). (A `null` value is permitted, and indicates that the cause is nonexistent or unknown.) |
|---|---|

#### public
**CertPathValidatorException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause)

Creates a `CertPathValidatorException` with the specified
detail message and cause.

##### Parameters

| msg | the detail message |
| cause | the cause (which is saved for later retrieval by the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getCause()` method). (A `null` value is permitted, and indicates that the cause is nonexistent or unknown.) |
|---|---|

#### public
**CertPathValidatorException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause, [CertPath](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPath.html) certPath, int index)

Creates a `CertPathValidatorException` with the specified
detail message, cause, certification path, and index.

##### Parameters

| msg | the detail message (or `null` if none) |
| cause | the cause (or `null` if none) |
| certPath | the certification path that was in the process of being validated when the error was encountered |
| index | the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a `CertPath` is zero based. |
|---|---|

##### Throws

| [IndexOutOfBoundsException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IndexOutOfBoundsException.html) | if the index is out of range `(index < -1 || (certPath != null && index >= certPath.getCertificates().size()) ` |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `certPath` is `null` and `index` is not -1 |
|---|---|

#### public
**CertPathValidatorException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) msg, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause, [CertPath](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPath.html) certPath, int index, [CertPathValidatorException.Reason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.Reason.html) reason)

Creates a `CertPathValidatorException` with the specified
detail message, cause, certification path, index, and reason.

##### Parameters

| msg | the detail message (or `null` if none) |
| cause | the cause (or `null` if none) |
| certPath | the certification path that was in the process of being validated when the error was encountered |
| index | the index of the certificate in the certification path that caused the error (or -1 if not applicable). Note that the list of certificates in a `CertPath` is zero based. |
| reason | the reason the validation failed |
|---|---|

##### Throws

| [IndexOutOfBoundsException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IndexOutOfBoundsException.html) | if the index is out of range `(index < -1 || (certPath != null && index >= certPath.getCertificates().size()) ` |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `certPath` is `null` and `index` is not -1 |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `reason` is `null` |
|---|---|

## Public Methods

#### public [CertPath](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPath.html)
**getCertPath**
()

Returns the certification path that was being validated when
the exception was thrown.

##### Returns

- the `CertPath` that was being validated when the exception was thrown (or `null` if not specified)

#### public int
**getIndex**
()

Returns the index of the certificate in the certification path
that caused the exception to be thrown. Note that the list of
certificates in a `CertPath` is zero based. If no
index has been set, -1 is returned.

##### Returns

- the index that has been set, or -1 if none has been set

#### public [CertPathValidatorException.Reason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.Reason.html)
**getReason**
()

Returns the reason that the validation failed. The reason is
associated with the index of the certificate returned by
`https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.html#getIndex()`.

##### Returns

- the reason that the validation failed, or `BasicReason.UNSPECIFIED` if a reason has not been specified