java.lang.Object
java.lang.Throwable
java.lang.Exception
java.security.GeneralSecurityException
java.security.cert.CertPathValidatorException
- 所有已实现的接口:
Serializable
指示验证证书路径时遇到的各种问题之一的异常。
CertPathValidatorException
提供对包装异常的支持。 getCause
方法返回导致抛出此异常的可抛出对象(如果有)。
CertPathValidatorException
还可能包括抛出异常时正在验证的证书路径、导致抛出异常的证书在证书路径中的索引以及导致失败的原因。使用 getCertPath
、 getIndex
和 getReason
方法检索此信息。
并发访问
除非另有说明,否则此类中定义的方法不是线程安全的。需要同时访问单个对象的多个线程应该在它们之间同步并提供必要的锁定。每个操作单独对象的多个线程不需要同步。
- 自从:
- 1.4
- 参见:
-
内部类总结
内部类修饰符和类型类描述static enum
BasicReason 列举了任何类型的证书路径可能无效的潜在原因。static interface
验证算法失败的原因。 -
构造方法总结
构造方法构造方法描述创建一个没有详细消息的CertPathValidatorException
。使用给定的详细消息创建CertPathValidatorException
。CertPathValidatorException
(String msg, Throwable cause) 使用指定的详细消息和原因创建CertPathValidatorException
。CertPathValidatorException
(String msg, Throwable cause, CertPath certPath, int index) 使用指定的详细消息、原因、证书路径和索引创建CertPathValidatorException
。CertPathValidatorException
(String msg, Throwable cause, CertPath certPath, int index, CertPathValidatorException.Reason reason) 使用指定的详细消息、原因、证书路径、索引和原因创建CertPathValidatorException
。创建一个包装指定 throwable 的CertPathValidatorException
。 -
方法总结
在类 java.lang.Throwable 中声明的方法
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
构造方法详细信息
-
CertPathValidatorException
public CertPathValidatorException()创建一个没有详细消息的CertPathValidatorException
。 -
CertPathValidatorException
使用给定的详细消息创建CertPathValidatorException
。详细消息是描述此特定异常的String
。- 参数:
msg
- 详细消息
-
CertPathValidatorException
创建一个包装指定 throwable 的CertPathValidatorException
。这允许将任何异常转换为CertPathValidatorException
,同时保留有关包装异常的信息,这可能对调试有用。详细消息设置为 (cause==null ? null : cause.toString()
)(通常包含原因的类别和详细消息)。- 参数:
cause
- 原因(保存以供以后通过getCause()
方法检索)。 (允许使用null
值,表示原因不存在或未知。)
-
CertPathValidatorException
使用指定的详细消息和原因创建CertPathValidatorException
。- 参数:
msg
- 详细消息cause
- 原因(保存以供以后通过getCause()
方法检索)。 (允许使用null
值,表示原因不存在或未知。)
-
CertPathValidatorException
使用指定的详细消息、原因、证书路径和索引创建CertPathValidatorException
。- 参数:
msg
- 详细消息(如果没有则为null
)cause
- 原因(如果没有则为null
)certPath
- 遇到错误时正在验证过程中的证书路径index
- 导致错误的证书路径中证书的索引(如果不适用,则为 -1)。请注意,CertPath
中的证书列表是从零开始的。- 抛出:
IndexOutOfBoundsException
- 如果索引超出范围(index < -1 || (certPath != null && index >= certPath.getCertificates().size())
IllegalArgumentException
- 如果certPath
是null
并且index
不是 -1
-
CertPathValidatorException
public CertPathValidatorException(String msg, Throwable cause, CertPath certPath, int index, CertPathValidatorException.Reason reason) 使用指定的详细消息、原因、证书路径、索引和原因创建CertPathValidatorException
。- 参数:
msg
- 详细消息(如果没有则为null
)cause
- 原因(如果没有则为null
)certPath
- 遇到错误时正在验证过程中的证书路径index
- 导致错误的证书路径中证书的索引(如果不适用,则为 -1)。请注意,CertPath
中的证书列表是从零开始的。reason
- 验证失败的原因- 抛出:
IndexOutOfBoundsException
- 如果索引超出范围(index < -1 || (certPath != null && index >= certPath.getCertificates().size())
IllegalArgumentException
- 如果certPath
是null
并且index
不是 -1NullPointerException
- 如果reason
是null
- 自从:
- 1.7
-
-
方法详情
-
getCertPath
返回抛出异常时正在验证的证书路径。- 返回:
-
抛出异常时正在验证的
CertPath
(如果未指定,则为null
)
-
getIndex
public int getIndex()返回证书在导致异常被抛出的证书路径中的索引。请注意,CertPath
中的证书列表是从零开始的。如果未设置索引,则返回 -1。- 返回:
- 已设置的索引,如果未设置则为 -1
-
getReason
返回验证失败的原因。原因与getIndex()
返回的证书索引有关。- 返回:
-
验证失败的原因,或者
BasicReason.UNSPECIFIED
如果没有指定原因 - 自从:
- 1.7
-