8282723: Add constructors taking a cause to JSSE exceptions

Reviewed-by: wetmore, iris
This commit is contained in:
Xue-Lei Andrew Fan 2022-03-20 06:46:13 +00:00
parent 3f923b82c3
commit 4df67426ed
30 changed files with 343 additions and 132 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,9 +36,7 @@ import java.io.IOException;
* @since 1.4
* @author David Brownell
*/
public
class SSLException extends IOException
{
public class SSLException extends IOException {
@java.io.Serial
private static final long serialVersionUID = 4511006460650708967L;
@ -48,8 +46,7 @@ class SSLException extends IOException
*
* @param reason describes the problem.
*/
public SSLException(String reason)
{
public SSLException(String reason) {
super(reason);
}
@ -66,8 +63,7 @@ class SSLException extends IOException
* @since 1.5
*/
public SSLException(String message, Throwable cause) {
super(message);
initCause(cause);
super(message, cause);
}
/**
@ -83,7 +79,6 @@ class SSLException extends IOException
* @since 1.5
*/
public SSLException(Throwable cause) {
super(cause == null ? null : cause.toString());
initCause(cause);
super(cause);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,10 +23,8 @@
* questions.
*/
package javax.net.ssl;
/**
* Indicates that the client and server could not negotiate the
* desired level of security. The connection is no longer usable.
@ -34,9 +32,7 @@ package javax.net.ssl;
* @since 1.4
* @author David Brownell
*/
public
class SSLHandshakeException extends SSLException
{
public class SSLHandshakeException extends SSLException {
@java.io.Serial
private static final long serialVersionUID = -5045881315018326890L;
@ -46,8 +42,23 @@ class SSLHandshakeException extends SSLException
*
* @param reason describes the problem.
*/
public SSLHandshakeException(String reason)
{
public SSLHandshakeException(String reason) {
super(reason);
}
/**
* 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);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,9 +33,7 @@ package javax.net.ssl;
* @since 1.4
* @author David Brownell
*/
public
class SSLKeyException extends SSLException
{
public class SSLKeyException extends SSLException {
@java.io.Serial
private static final long serialVersionUID = -8071664081941937874L;
@ -45,8 +43,23 @@ class SSLKeyException extends SSLException
*
* @param reason describes the problem.
*/
public SSLKeyException(String reason)
{
public SSLKeyException(String reason) {
super(reason);
}
/**
* 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);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,9 +39,7 @@ package javax.net.ssl;
* @since 1.4
* @author David Brownell
*/
public
class SSLPeerUnverifiedException extends SSLException
{
public class SSLPeerUnverifiedException extends SSLException {
@java.io.Serial
private static final long serialVersionUID = -8919512675000600547L;
@ -51,8 +49,23 @@ class SSLPeerUnverifiedException extends SSLException
*
* @param reason describes the problem.
*/
public SSLPeerUnverifiedException(String reason)
{
public SSLPeerUnverifiedException(String reason) {
super(reason);
}
/**
* 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);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,9 +33,7 @@ package javax.net.ssl;
* @since 1.4
* @author David Brownell
*/
public
class SSLProtocolException extends SSLException
{
public class SSLProtocolException extends SSLException {
@java.io.Serial
private static final long serialVersionUID = 5445067063799134928L;
@ -45,8 +43,23 @@ class SSLProtocolException extends SSLException
*
* @param reason describes the problem.
*/
public SSLProtocolException(String reason)
{
public SSLProtocolException(String reason) {
super(reason);
}
/**
* 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);
}
}