1/*
2 * Copyright (c) 2000, 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
26package sun.security.provider.certpath;
27
28import java.util.List;
29import java.security.cert.CertPathBuilderException;
30
31/**
32 * This is a subclass of the generic <code>CertPathBuilderException</code>.
33 * It contains an adjacency list with information regarding the unsuccessful
34 * paths that the SunCertPathBuilder tried.
35 *
36 * @since       1.4
37 * @author      Sean Mullan
38 * @see         CertPathBuilderException
39 */
40public class SunCertPathBuilderException extends CertPathBuilderException {
41
42    private static final long serialVersionUID = -7814288414129264709L;
43
44    /**
45     * @serial
46     */
47    private transient AdjacencyList adjList;
48
49    /**
50     * Constructs a <code>SunCertPathBuilderException</code> with
51     * <code>null</code> as its detail message.
52     */
53    public SunCertPathBuilderException() {
54        super();
55    }
56
57    /**
58     * Constructs a <code>SunCertPathBuilderException</code> with the specified
59     * detail message. A detail message is a <code>String</code> that
60     * describes this particular exception.
61     *
62     * @param msg the detail message
63     */
64    public SunCertPathBuilderException(String msg) {
65        super(msg);
66    }
67
68    /**
69     * Constructs a <code>SunCertPathBuilderException</code> that wraps the
70     * specified throwable. This allows any exception to be converted into a
71     * <code>SunCertPathBuilderException</code>, while retaining information
72     * about the cause, which may be useful for debugging. The detail message is
73     * set to (<code>cause==null ? null : cause.toString()</code>) (which
74     * typically contains the class and detail message of cause).
75     *
76     * @param cause the cause (which is saved for later retrieval by the
77     * {@link #getCause getCause()} method). (A <code>null</code> value is
78     * permitted, and indicates that the cause is nonexistent or unknown.)
79     * root cause.
80     */
81    public SunCertPathBuilderException(Throwable cause) {
82        super(cause);
83    }
84
85    /**
86     * Creates a <code>SunCertPathBuilderException</code> with the specified
87     * detail message and cause.
88     *
89     * @param msg the detail message
90     * @param cause the cause
91     */
92    public SunCertPathBuilderException(String msg, Throwable cause) {
93        super(msg, cause);
94    }
95
96    /**
97     * Creates a <code>SunCertPathBuilderException</code> withe the specified
98     * detail message and adjacency list.
99     *
100     * @param msg the detail message
101     * @param adjList the adjacency list
102     */
103    SunCertPathBuilderException(String msg, AdjacencyList adjList) {
104        this(msg);
105        this.adjList = adjList;
106    }
107
108    /**
109     * Creates a <code>SunCertPathBuilderException</code> with the specified
110     * detail message, cause, and adjacency list.
111     *
112     * @param msg the detail message
113     * @param cause the throwable that occurred
114     * @param adjList Adjacency list
115     */
116    SunCertPathBuilderException(String msg, Throwable cause,
117        AdjacencyList adjList)
118    {
119        this(msg, cause);
120        this.adjList = adjList;
121    }
122
123    /**
124     * Returns the adjacency list containing information about the build.
125     *
126     * @return the adjacency list containing information about the build
127     */
128    public AdjacencyList getAdjacencyList() {
129        return adjList;
130    }
131}
132