jdk/src/share/classes/java/sql/SQLClientInfoException.java
author chegar
Tue, 12 May 2009 16:32:34 +0100
changeset 3450 2f08a8bb9b83
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
6801071: Remote sites can compromise user privacy and possibly hijack web sessions Reviewed-by: jccollet, hawtin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package java.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * The subclass of {@link SQLException} is thrown when one or more client info properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * could not be set on a <code>Connection</code>.  In addition to the information provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * by <code>SQLException</code>, a <code>SQLClientInfoException</code> provides a list of client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * properties that were not set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * Some databases do not allow multiple client info properties to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * atomically.  For those databases, it is possible that some of the client
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * info properties had been set even though the <code>Connection.setClientInfo</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * method threw an exception.  An application can use the <code>getFailedProperties </code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * method to retrieve a list of client info properties that were not set.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * properties are identified by passing a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <code>Map&lt;String,ClientInfoStatus&gt;</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * the appropriate <code>SQLClientInfoException</code> constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @see ClientInfoStatus
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @see Connection#setClientInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
public class SQLClientInfoException extends SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        private Map<String, ClientInfoStatus>   failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * Constructs a <code>SQLClientInfoException</code>  Object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * The <code>reason</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * <code>SQLState</code>, and failedProperties list are initialized to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * <code> null</code> and the vendor code is initialized to 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * The <code>cause</code> is not initialized, and may subsequently be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * initialized by a call to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * {@link Throwable#initCause(java.lang.Throwable)} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        public SQLClientInfoException() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                this.failedProperties = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * Constructs a <code>SQLClientInfoException</code> object initialized with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * given <code>failedProperties</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * The <code>reason</code> and <code>SQLState</code> are initialized
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * to <code>null</code> and the vendor code is initialized to 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * The <code>cause</code> is not initialized, and may subsequently be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * initialized by a call to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * {@link Throwable#initCause(java.lang.Throwable)} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @param failedProperties          A Map containing the property values that could not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     *                                  be set.  The keys in the Map
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     *                                  contain the names of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     *                                  properties that could not be set and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     *                                  the values contain one of the reason codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     *                                  defined in <code>ClientInfoStatus</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        public SQLClientInfoException(Map<String, ClientInfoStatus> failedProperties) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                this.failedProperties = failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * Constructs a <code>SQLClientInfoException</code> object initialized with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * a given <code>cause</code> and <code>failedProperties</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * The <code>reason</code>  is initialized to <code>null</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <code>cause==null</code> or to <code>cause.toString()</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * <code>cause!=null</code> and the vendor code is initialized to 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @param failedProperties          A Map containing the property values that could not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *                                  be set.  The keys in the Map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     *                                  contain the names of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *                                  properties that could not be set and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *                                  the values contain one of the reason codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     *                                  defined in <code>ClientInfoStatus</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * @param cause                                     the (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *     the cause is non-existent or unknown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        public SQLClientInfoException(Map<String, ClientInfoStatus> failedProperties,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                                                           Throwable cause) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                super(cause != null?cause.toString():null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                initCause(cause);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                this.failedProperties = failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * Constructs a <code>SQLClientInfoException</code> object initialized with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * given <code>reason</code> and <code>failedProperties</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * The <code>SQLState</code> is initialized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * to <code>null</code> and the vendor code is initialized to 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * The <code>cause</code> is not initialized, and may subsequently be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * initialized by a call to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * {@link Throwable#initCause(java.lang.Throwable)} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @param reason                            a description of the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @param failedProperties          A Map containing the property values that could not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *                                  be set.  The keys in the Map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     *                                  contain the names of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     *                                  properties that could not be set and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     *                                  the values contain one of the reason codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     *                                  defined in <code>ClientInfoStatus</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        public SQLClientInfoException(String reason,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                Map<String, ClientInfoStatus> failedProperties) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                super(reason);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                this.failedProperties = failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * Constructs a <code>SQLClientInfoException</code> object initialized with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * given <code>reason</code>, <code>cause</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * <code>failedProperties</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * The  <code>SQLState</code> is initialized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * to <code>null</code> and the vendor code is initialized to 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * @param reason                            a description of the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * @param failedProperties          A Map containing the property values that could not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *                                  be set.  The keys in the Map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *                                  contain the names of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *                                  properties that could not be set and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *                                  the values contain one of the reason codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     *                                  defined in <code>ClientInfoStatus</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *     the cause is non-existent or unknown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        public SQLClientInfoException(String reason,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                                                           Map<String, ClientInfoStatus> failedProperties,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                                                           Throwable cause) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                super(reason);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                initCause(cause);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                this.failedProperties = failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * Constructs a <code>SQLClientInfoException</code> object initialized with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * given  <code>reason</code>, <code>SQLState</code>  and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * <code>failedProperties</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * The <code>cause</code> is not initialized, and may subsequently be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * initialized by a call to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * is initialized to 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @param reason                            a description of the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * @param SQLState                          an XOPEN or SQL:2003 code identifying the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @param failedProperties          A Map containing the property values that could not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *                                  be set.  The keys in the Map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     *                                  contain the names of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     *                                  properties that could not be set and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *                                  the values contain one of the reason codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *                                  defined in <code>ClientInfoStatus</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        public SQLClientInfoException(String reason,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                                                           String SQLState,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                                                           Map<String, ClientInfoStatus> failedProperties) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                super(reason, SQLState);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                this.failedProperties = failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * Constructs a <code>SQLClientInfoException</code> object initialized with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * given  <code>reason</code>, <code>SQLState</code>, <code>cause</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * and <code>failedProperties</code>.  The vendor code is initialized to 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * @param reason                            a description of the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * @param SQLState                          an XOPEN or SQL:2003 code identifying the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @param failedProperties          A Map containing the property values that could not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *                                  be set.  The keys in the Map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *                                  contain the names of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *                                  properties that could not be set and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *                                  the values contain one of the reason codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     *                                  defined in <code>ClientInfoStatus</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * @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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *     the cause is non-existent or unknown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        public SQLClientInfoException(String reason,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                                                           String SQLState,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                                                           Map<String, ClientInfoStatus> failedProperties,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                                                           Throwable cause) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                super(reason, SQLState);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                initCause(cause);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                this.failedProperties = failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * Constructs a <code>SQLClientInfoException</code> object initialized with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * given  <code>reason</code>, <code>SQLState</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * <code>vendorCode</code>  and <code>failedProperties</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * The <code>cause</code> is not initialized, and may subsequently be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * initialized by a call to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * {@link Throwable#initCause(java.lang.Throwable)} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * @param reason                            a description of the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * @param SQLState                          an XOPEN or SQL:2003 code identifying the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @param vendorCode                        a database vendor-specific exception code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * @param failedProperties          A Map containing the property values that could not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     *                                  be set.  The keys in the Map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     *                                  contain the names of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     *                                  properties that could not be set and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     *                                  the values contain one of the reason codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     *                                  defined in <code>ClientInfoStatus</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        public SQLClientInfoException(String reason,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                                                           String SQLState,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                                                           int vendorCode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                                                           Map<String, ClientInfoStatus> failedProperties) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                super(reason, SQLState, vendorCode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                this.failedProperties = failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * Constructs a <code>SQLClientInfoException</code> object initialized with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * given  <code>reason</code>, <code>SQLState</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * <code>cause</code>, <code>vendorCode</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * <code>failedProperties</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * @param reason                            a description of the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * @param SQLState                          an XOPEN or SQL:2003 code identifying the exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * @param vendorCode                        a database vendor-specific exception code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * @param failedProperties          A Map containing the property values that could not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     *                                  be set.  The keys in the Map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     *                                  contain the names of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     *                                  properties that could not be set and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     *                                  the values contain one of the reason codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     *                                  defined in <code>ClientInfoStatus</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * @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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     *     the cause is non-existent or unknown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        public SQLClientInfoException(String reason,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
                                                           String SQLState,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
                                                           int vendorCode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                                                           Map<String, ClientInfoStatus> failedProperties,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                                                           Throwable cause) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
                super(reason, SQLState, vendorCode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                initCause(cause);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                this.failedProperties = failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * Returns the list of client info properties that could not be set.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * keys in the Map  contain the names of the client info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * properties that could not be set and the values contain one of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * reason codes defined in <code>ClientInfoStatus</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * @return Map list containing the client info properties that could
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * not be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        public Map<String, ClientInfoStatus> getFailedProperties() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                return this.failedProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    private static final long serialVersionUID = -4319604256824655880L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
}