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);
+ }