2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 import java.util.HashMap;
24 * An exception, which is subclass of SQLException, is thrown when one or more
25 * client info properties could not be set on a Connection.
27 public class SQLClientInfoException extends SQLException {
28 private static final long serialVersionUID = -4319604256824655880L;
30 final private Map<String, ClientInfoStatus> failedProperties;
33 * Creates an SQLClientInfoException object. The Reason string is set to
34 * null, the SQLState string is set to null and the Error Code is set to 0.
36 public SQLClientInfoException() {
37 this.failedProperties = null;
41 * Creates an SQLClientInfoException object. The Reason string is set to the
42 * given reason string, the SQLState string is set to null and the Error
43 * Code is set to 0, and the Map<String,ClientInfoStatus> object is set to
44 * the failed properties.
46 * @param failedProperties
47 * the Map<String,ClientInfoStatus> object to use as the
50 public SQLClientInfoException(Map<String, ClientInfoStatus> failedProperties) {
51 this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
55 * Creates an SQLClientInfoException object. The Reason string is set to the
56 * null if cause == null or cause.toString() if cause!=null, the cause
57 * Throwable object is set to the given cause Throwable object, and the Map<String,ClientInfoStatus>
58 * object is set to the failed properties.
60 * @param failedProperties
61 * the Map<String,ClientInfoStatus> object to use as the
64 * the Throwable object for the underlying reason this
67 public SQLClientInfoException(
68 Map<String, ClientInfoStatus> failedProperties, Throwable cause) {
70 this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
74 * Creates an SQLClientInfoException object. The Reason string is set to
75 * reason, and the Map<String,ClientInfoStatus> object is set to the failed
79 * the string to use as the Reason string
80 * @param failedProperties
81 * the Map<String,ClientInfoStatus> object to use as the
84 public SQLClientInfoException(String reason,
85 Map<String, ClientInfoStatus> failedProperties) {
87 this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
91 * Creates an SQLClientInfoException object. The Reason string is set to
92 * reason, the cause Throwable object is set to the given cause Throwable
93 * object, and the Map<String,ClientInfoStatus> object is set to the failed
97 * the string to use as the Reason string
98 * @param failedProperties
99 * the Map<String,ClientInfoStatus> object to use as the
102 * the Throwable object for the underlying reason this
105 public SQLClientInfoException(String reason,
106 Map<String, ClientInfoStatus> failedProperties, Throwable cause) {
107 super(reason, cause);
108 this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
112 * Creates an SQLClientInfoException object. The Reason string is set to
113 * reason, the SQLState string is set to the sqlState, the Error Code is set
114 * to the vendorCode and the Map<String,ClientInfoStatus> object is set to
115 * the failed properties.
118 * the string to use as the Reason string
120 * the string to use as the SQLState string
122 * the integer value for the error code
123 * @param failedProperties
124 * the Map<String,ClientInfoStatus> object to use as the
128 public SQLClientInfoException(String reason, String sqlState,
129 int vendorCode, Map<String, ClientInfoStatus> failedProperties) {
130 super(reason, sqlState, vendorCode);
131 this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
135 * Creates an SQLClientInfoException object. The Reason string is set to
136 * reason, the SQLState string is set to the sqlState, the Error Code is set
137 * to the vendorCode the cause Throwable object is set to the given cause
138 * Throwable object, and the Map<String,ClientInfoStatus> object is set to
139 * the failed properties.
142 * the string to use as the Reason string
144 * the string to use as the SQLState string
146 * the integer value for the error code
147 * @param failedProperties
148 * the Map<String,ClientInfoStatus> object to use as the
151 * the Throwable object for the underlying reason this
154 public SQLClientInfoException(String reason, String sqlState,
155 int vendorCode, Map<String, ClientInfoStatus> failedProperties,
157 super(reason, sqlState, vendorCode, cause);
158 this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
162 * Creates an SQLClientInfoException object. The Reason string is set to
163 * reason, the SQLState string is set to the sqlState, and the Map<String,ClientInfoStatus>
164 * object is set to the failed properties.
167 * the string to use as the Reason string
169 * the string to use as the SQLState string
170 * @param failedProperties
171 * the Map<String,ClientInfoStatus> object to use as the
174 public SQLClientInfoException(String reason, String sqlState,
175 Map<String, ClientInfoStatus> failedProperties) {
176 super(reason, sqlState);
177 this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
181 * Creates an SQLClientInfoException object. The Reason string is set to
182 * reason, the SQLState string is set to the sqlState, the Error Code is set
183 * to the vendorCode, and the Map<String,ClientInfoStatus> object is set to
184 * the failed properties.
187 * the string to use as the Reason string
189 * the string to use as the SQLState string
190 * @param failedProperties
191 * the Map<String,ClientInfoStatus> object to use as the
194 * the Throwable object for the underlying reason this
197 public SQLClientInfoException(String reason, String sqlState,
198 Map<String, ClientInfoStatus> failedProperties, Throwable cause) {
199 super(reason, sqlState, cause);
200 this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
204 * returns that the client info properties which could not be set
206 * @return the list of ClientInfoStatus objects indicate client info
209 public Map<String, ClientInfoStatus> getFailedProperties() {
210 return failedProperties;