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

Add constructors taking a cause to JSSE exceptions

    XMLWordPrintable

    Details

    • Subcomponent:
    • Compatibility Kind:
      source
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Hide
      Add conventional constructors taking a cause to the exception classes.
      Show
      Add conventional constructors taking a cause to the exception classes.
    • Interface Kind:
      Java API
    • Scope:
      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

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

                Dates

                Created:
                Updated:
                Resolved: