Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8282724

Add constructors taking a cause to JSSE exceptions

    XMLWordPrintable

Details

    • source
    • minimal
    • Hide
      Add conventional constructors taking a cause to the exception classes.
      Show
      Add conventional constructors taking a cause to the exception classes.
    • Java API
    • SE

    Description

      Summary

      Add conventional constructors that take a cause to javax.net.ssl exception classes to avoid the need to call initCause as part of creating the exception.

      Problem

      The creation of many javax.net.ssl exception classes involves setting the cause, but the set of constructors does not include any ones taking a cause.

      Solution

      Add the the missing conventional constructors that take a cause argument. This change is to match the API that already exists in SSLException.

      Specification

      1. Update on javax.net.ssl.SSLHandshakeException

        +    /**
        +     * Creates a {@code SSLHandshakeException} with the specified detail
        +     * message and cause.
        +     *
        +     * @param message the detail message (which is saved for later retrieval
        +     *        by the {@link #getMessage()} method).
        +     * @param cause the cause (which is saved for later retrieval by the
        +     *        {@link #getCause()} method).  (A {@code null} value is
        +     *        permitted, and indicates that the cause is nonexistent or
        +     *        unknown.)
        +     * @since 19
        +     */
        +    public SSLHandshakeException(String message, Throwable cause) {
        +        super(message, cause);
        +    }
      2. Update on SSLKeyException

        +    /**
        +     * Creates a {@code SSLKeyException} with the specified detail
        +     * message and cause.
        +     *
        +     * @param message the detail message (which is saved for later retrieval
        +     *        by the {@link #getMessage()} method).
        +     * @param cause the cause (which is saved for later retrieval by the
        +     *        {@link #getCause()} method).  (A {@code null} value is
        +     *        permitted, and indicates that the cause is nonexistent or
        +     *        unknown.)
        +     * @since 19
        +     */
        +    public SSLKeyException(String message, Throwable cause) {
        +        super(message, cause);
        +    }
      3. Update on SSLPeerUnverifiedException

        +    /**
        +     * Creates a {@code SSLPeerUnverifiedException} with the specified detail
        +     * message and cause.
        +     *
        +     * @param message the detail message (which is saved for later retrieval
        +     *        by the {@link #getMessage()} method).
        +     * @param cause the cause (which is saved for later retrieval by the
        +     *        {@link #getCause()} method).  (A {@code null} value is
        +     *        permitted, and indicates that the cause is nonexistent or
        +     *        unknown.)
        +     * @since 19
        +     */
        +    public SSLPeerUnverifiedException(String message, Throwable cause) {
        +        super(message, cause);
        +    }
      4. Update on SSLProtocolException

        +    /**
        +     * Creates a {@code SSLProtocolException} with the specified detail
        +     * message and cause.
        +     *
        +     * @param message the detail message (which is saved for later retrieval
        +     *        by the {@link #getMessage()} method).
        +     * @param cause the cause (which is saved for later retrieval by the
        +     *        {@link #getCause()} method).  (A {@code null} value is
        +     *        permitted, and indicates that the cause is nonexistent or
        +     *        unknown.)
        +     * @since 19
        +     */
        +    public SSLProtocolException(String message, Throwable cause) {
        +        super(message, cause);
        +    }

      Attachments

        Issue Links

          Activity

            People

              xuelei Xuelei Fan
              xuelei Xuelei Fan
              Bradford Wetmore
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: