模块 java.base

类 CertPathValidatorException

所有已实现的接口:
Serializable

public class CertPathValidatorException extends GeneralSecurityException
指示验证证书路径时遇到的各种问题之一的异常。

CertPathValidatorException 提供对包装异常的支持。 getCause 方法返回导致抛出此异常的可抛出对象(如果有)。

CertPathValidatorException 还可能包括抛出异常时正在验证的证书路径、导致抛出异常的证书在证书路径中的索引以及导致失败的原因。使用 getCertPath getIndex getReason 方法检索此信息。

并发访问

除非另有说明,否则此类中定义的方法不是线程安全的。需要同时访问单个对象的多个线程应该在它们之间同步并提供必要的锁定。每个操作单独对象的多个线程不需要同步。

自从:
1.4
参见:
  • 构造方法详细信息

    • CertPathValidatorException

      public CertPathValidatorException()
      创建一个没有详细消息的CertPathValidatorException
    • CertPathValidatorException

      public CertPathValidatorException(String  msg)
      使用给定的详细消息创建 CertPathValidatorException。详细消息是描述此特定异常的 String
      参数:
      msg - 详细消息
    • CertPathValidatorException

      public CertPathValidatorException(Throwable  cause)
      创建一个包装指定 throwable 的 CertPathValidatorException。这允许将任何异常转换为 CertPathValidatorException ,同时保留有关包装异常的信息,这可能对调试有用。详细消息设置为 (cause==null ? null : cause.toString())(通常包含原因的类别和详细消息)。
      参数:
      cause - 原因(保存以供以后通过 getCause() 方法检索)。 (允许使用 null 值,表示原因不存在或未知。)
    • CertPathValidatorException

      public CertPathValidatorException(String  msg, Throwable  cause)
      使用指定的详细消息和原因创建 CertPathValidatorException
      参数:
      msg - 详细消息
      cause - 原因(保存以供以后通过 getCause() 方法检索)。 (允许使用 null 值,表示原因不存在或未知。)
    • CertPathValidatorException

      public CertPathValidatorException(String  msg, Throwable  cause, CertPath  certPath, int index)
      使用指定的详细消息、原因、证书路径和索引创建 CertPathValidatorException
      参数:
      msg - 详细消息(如果没有则为 null
      cause - 原因(如果没有则为 null
      certPath - 遇到错误时正在验证过程中的证书路径
      index - 导致错误的证书路径中证书的索引(如果不适用,则为 -1)。请注意,CertPath 中的证书列表是从零开始的。
      抛出:
      IndexOutOfBoundsException - 如果索引超出范围 (index < -1 || (certPath != null && index >= certPath.getCertificates().size())
      IllegalArgumentException - 如果 certPathnull 并且 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 - 如果 certPathnull 并且 index 不是 -1
      NullPointerException - 如果 reasonnull
      自从:
      1.7
  • 方法详情

    • getCertPath

      public CertPath  getCertPath()
      返回抛出异常时正在验证的证书路径。
      返回:
      抛出异常时正在验证的 CertPath(如果未指定,则为 null
    • getIndex

      public int getIndex()
      返回证书在导致异常被抛出的证书路径中的索引。请注意,CertPath 中的证书列表是从零开始的。如果未设置索引,则返回 -1。
      返回:
      已设置的索引,如果未设置则为 -1
    • getReason

      public CertPathValidatorException.Reason  getReason()
      返回验证失败的原因。原因与 getIndex() 返回的证书索引有关。
      返回:
      验证失败的原因,或者 BasicReason.UNSPECIFIED 如果没有指定原因
      自从:
      1.7