1 /*
2  * Copyright (c) 2005, 2013, 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 package java.sql;
27 
28 /**
29  * The subclass of {@link SQLException} thrown when an instance where a retry
30  * of the same operation would fail unless the cause of the <code>SQLException</code>
31  * is corrected.
32  *
33  * @since 1.6
34  */
35 public class SQLNonTransientException extends java.sql.SQLException {
36 
37         /**
38          * Constructs a <code>SQLNonTransientException</code> object.
39          *  The <code>reason</code>, <code>SQLState</code> are initialized
40          * to <code>null</code> and the vendor code is initialized to 0.
41          *
42          * The <code>cause</code> is not initialized, and may subsequently be
43          * initialized by a call to the
44          * {@link Throwable#initCause(java.lang.Throwable)} method.
45          *
46          * @since 1.6
47          */
SQLNonTransientException()48         public SQLNonTransientException() {
49         super();
50         }
51 
52         /**
53          * Constructs a <code>SQLNonTransientException</code> object
54          * with a given <code>reason</code>. The <code>SQLState</code>
55          * is initialized to <code>null</code> and the vendor code is initialized
56          * to 0.
57          *
58          * The <code>cause</code> is not initialized, and may subsequently be
59          * initialized by a call to the
60          * {@link Throwable#initCause(java.lang.Throwable)} method.
61          *
62          * @param reason a description of the exception
63          * @since 1.6
64          */
SQLNonTransientException(String reason)65         public SQLNonTransientException(String reason) {
66                 super(reason);
67         }
68 
69         /**
70          * Constructs a <code>SQLNonTransientException</code> object
71          * with a given <code>reason</code> and <code>SQLState</code>.
72          *
73          * The <code>cause</code> is not initialized, and may subsequently be
74          * initialized by a call to the
75          * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
76          * is initialized to 0.
77          *
78          * @param reason a description of the exception
79          * @param SQLState an XOPEN or SQL:2003 code identifying the exception
80          * @since 1.6
81          */
SQLNonTransientException(String reason, String SQLState)82         public SQLNonTransientException(String reason, String SQLState) {
83                 super(reason,SQLState);
84         }
85 
86         /**
87          * Constructs a <code>SQLNonTransientException</code> object
88          * with a given <code>reason</code>, <code>SQLState</code>  and
89          * <code>vendorCode</code>.
90          *
91          * The <code>cause</code> is not initialized, and may subsequently be
92          * initialized by a call to the
93          * {@link Throwable#initCause(java.lang.Throwable)} method.
94          *
95          * @param reason a description of the exception
96          * @param SQLState an XOPEN or SQL:2003 code identifying the exception
97          * @param vendorCode a database vendor specific exception code
98          * @since 1.6
99          */
SQLNonTransientException(String reason, String SQLState, int vendorCode)100         public SQLNonTransientException(String reason, String SQLState, int vendorCode) {
101                  super(reason,SQLState,vendorCode);
102         }
103 
104     /**
105      * Constructs a <code>SQLNonTransientException</code> object
106      *  with a given  <code>cause</code>.
107      * The <code>SQLState</code> is initialized
108      * to <code>null</code> and the vendor code is initialized to 0.
109      * The <code>reason</code>  is initialized to <code>null</code> if
110      * <code>cause==null</code> or to <code>cause.toString()</code> if
111      * <code>cause!=null</code>.
112      *
113      * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
114      *     the cause is non-existent or unknown.
115      * @since 1.6
116      */
SQLNonTransientException(Throwable cause)117     public SQLNonTransientException(Throwable cause) {
118         super(cause);
119     }
120 
121     /**
122      * Constructs a <code>SQLTransientException</code> object
123      * with a given
124      * <code>reason</code> and  <code>cause</code>.
125      * The <code>SQLState</code> is  initialized to <code>null</code>
126      * and the vendor code is initialized to 0.
127      *
128      * @param reason a description of the exception.
129      * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
130      *     the cause is non-existent or unknown.
131      * @since 1.6
132      */
SQLNonTransientException(String reason, Throwable cause)133     public SQLNonTransientException(String reason, Throwable cause) {
134         super(reason,cause);
135 
136     }
137 
138     /**
139      * Constructs a <code>SQLNonTransientException</code> object
140      * with a given
141      * <code>reason</code>, <code>SQLState</code> and  <code>cause</code>.
142      * The vendor code is initialized to 0.
143      *
144      * @param reason a description of the exception.
145      * @param SQLState an XOPEN or SQL:2003 code identifying the exception
146      * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
147      *     the cause is non-existent or unknown.
148      * @since 1.6
149      */
SQLNonTransientException(String reason, String SQLState, Throwable cause)150     public SQLNonTransientException(String reason, String SQLState, Throwable cause) {
151         super(reason,SQLState,cause);
152     }
153 
154     /**
155      * Constructs a <code>SQLNonTransientException</code> object
156      * with a given
157      * <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>
158      * and  <code>cause</code>.
159      *
160      * @param reason a description of the exception
161      * @param SQLState an XOPEN or SQL:2003 code identifying the exception
162      * @param vendorCode a database vendor-specific exception code
163      * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
164      *     the cause is non-existent or unknown.
165      * @since 1.6
166      */
SQLNonTransientException(String reason, String SQLState, int vendorCode, Throwable cause)167     public SQLNonTransientException(String reason, String SQLState, int vendorCode, Throwable cause) {
168         super(reason,SQLState,vendorCode,cause);
169     }
170 
171    private static final long serialVersionUID = -9104382843534716547L;
172 }
173