1 /*
   2  * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 
  27 package javax.net.ssl;
  28 
  29 import java.io.IOException;
  30 
  31 /**
  32  * Indicates some kind of error detected by an SSL subsystem.
  33  * This class is the general class of exceptions produced
  34  * by failed SSL-related operations.
  35  *
  36  * @since 1.4
  37  * @author David Brownell
  38  */
  39 public
  40 class SSLException extends IOException
  41 {
  42     @java.io.Serial
  43     private static final long serialVersionUID = 4511006460650708967L;
  44 
  45     /**
  46      * Constructs an exception reporting an error found by
  47      * an SSL subsystem.
  48      *
  49      * @param reason describes the problem.
  50      */
  51     public SSLException(String reason)
  52     {
  53         super(reason);
  54     }
  55 
  56     /**
  57      * Creates a {@code SSLException} with the specified
  58      * detail message and cause.
  59      *
  60      * @param message the detail message (which is saved for later retrieval
  61      *          by the {@link #getMessage()} method).
  62      * @param cause the cause (which is saved for later retrieval by the
  63      *          {@link #getCause()} method).  (A {@code null} value is
  64      *          permitted, and indicates that the cause is nonexistent or
  65      *          unknown.)
  66      * @since 1.5
  67      */
  68     public SSLException(String message, Throwable cause) {
  69         super(message);
  70         initCause(cause);
  71     }
  72 
  73     /**
  74      * Creates a {@code SSLException} with the specified cause
  75      * and a detail message of {@code (cause==null ? null : cause.toString())}
  76      * (which typically contains the class and detail message of
  77      * {@code cause}).
  78      *
  79      * @param cause the cause (which is saved for later retrieval by the
  80      *          {@link #getCause()} method).  (A {@code null} value is
  81      *          permitted, and indicates that the cause is nonexistent or
  82      *          unknown.)
  83      * @since 1.5
  84      */
  85     public SSLException(Throwable cause) {
  86         super(cause == null ? null : cause.toString());
  87         initCause(cause);
  88     }
  89 }