/luni/src/main/java/java/sql/SQLClientInfoException.java

https://bitbucket.org/aways/android_libcore · Java · 212 lines · 52 code · 14 blank · 146 comment · 0 complexity · e066f1b46a87d38527b2fa957b18bd8b MD5 · raw file

  1. /*
  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
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  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.
  16. */
  17. package java.sql;
  18. import java.util.HashMap;
  19. import java.util.Map;
  20. /**
  21. * An exception, which is subclass of SQLException, is thrown when one or more
  22. * client info properties could not be set on a Connection.
  23. */
  24. public class SQLClientInfoException extends SQLException {
  25. private static final long serialVersionUID = -4319604256824655880L;
  26. final private Map<String, ClientInfoStatus> failedProperties;
  27. /**
  28. * Creates an SQLClientInfoException object. The Reason string is set to
  29. * null, the SQLState string is set to null and the Error Code is set to 0.
  30. */
  31. public SQLClientInfoException() {
  32. this.failedProperties = null;
  33. }
  34. /**
  35. * Creates an SQLClientInfoException object. The Reason string is set to the
  36. * given reason string, the SQLState string is set to null and the Error
  37. * Code is set to 0, and the Map<String,ClientInfoStatus> object is set to
  38. * the failed properties.
  39. *
  40. * @param failedProperties
  41. * the Map<String,ClientInfoStatus> object to use as the
  42. * property values
  43. */
  44. public SQLClientInfoException(Map<String, ClientInfoStatus> failedProperties) {
  45. this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
  46. }
  47. /**
  48. * Creates an SQLClientInfoException object. The Reason string is set to the
  49. * null if cause == null or cause.toString() if cause!=null, the cause
  50. * Throwable object is set to the given cause Throwable object, and the Map<String,ClientInfoStatus>
  51. * object is set to the failed properties.
  52. *
  53. * @param failedProperties
  54. * the Map<String,ClientInfoStatus> object to use as the
  55. * property values
  56. * @param cause
  57. * the Throwable object for the underlying reason this
  58. * SQLException
  59. */
  60. public SQLClientInfoException(
  61. Map<String, ClientInfoStatus> failedProperties, Throwable cause) {
  62. super(cause);
  63. this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
  64. }
  65. /**
  66. * Creates an SQLClientInfoException object. The Reason string is set to
  67. * reason, and the Map<String,ClientInfoStatus> object is set to the failed
  68. * properties.
  69. *
  70. * @param reason
  71. * the string to use as the Reason string
  72. * @param failedProperties
  73. * the Map<String,ClientInfoStatus> object to use as the
  74. * property values
  75. */
  76. public SQLClientInfoException(String reason,
  77. Map<String, ClientInfoStatus> failedProperties) {
  78. super(reason);
  79. this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
  80. }
  81. /**
  82. * Creates an SQLClientInfoException object. The Reason string is set to
  83. * reason, the cause Throwable object is set to the given cause Throwable
  84. * object, and the Map<String,ClientInfoStatus> object is set to the failed
  85. * properties.
  86. *
  87. * @param reason
  88. * the string to use as the Reason string
  89. * @param failedProperties
  90. * the Map<String,ClientInfoStatus> object to use as the
  91. * property values
  92. * @param cause
  93. * the Throwable object for the underlying reason this
  94. * SQLException
  95. */
  96. public SQLClientInfoException(String reason,
  97. Map<String, ClientInfoStatus> failedProperties, Throwable cause) {
  98. super(reason, cause);
  99. this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
  100. }
  101. /**
  102. * Creates an SQLClientInfoException object. The Reason string is set to
  103. * reason, the SQLState string is set to the sqlState, the Error Code is set
  104. * to the vendorCode and the Map<String,ClientInfoStatus> object is set to
  105. * the failed properties.
  106. *
  107. * @param reason
  108. * the string to use as the Reason string
  109. * @param sqlState
  110. * the string to use as the SQLState string
  111. * @param vendorCode
  112. * the integer value for the error code
  113. * @param failedProperties
  114. * the Map<String,ClientInfoStatus> object to use as the
  115. * property values
  116. *
  117. */
  118. public SQLClientInfoException(String reason, String sqlState,
  119. int vendorCode, Map<String, ClientInfoStatus> failedProperties) {
  120. super(reason, sqlState, vendorCode);
  121. this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
  122. }
  123. /**
  124. * Creates an SQLClientInfoException object. The Reason string is set to
  125. * reason, the SQLState string is set to the sqlState, the Error Code is set
  126. * to the vendorCode the cause Throwable object is set to the given cause
  127. * Throwable object, and the Map<String,ClientInfoStatus> object is set to
  128. * the failed properties.
  129. *
  130. * @param reason
  131. * the string to use as the Reason string
  132. * @param sqlState
  133. * the string to use as the SQLState string
  134. * @param vendorCode
  135. * the integer value for the error code
  136. * @param failedProperties
  137. * the Map<String,ClientInfoStatus> object to use as the
  138. * property values
  139. * @param cause
  140. * the Throwable object for the underlying reason this
  141. * SQLException
  142. */
  143. public SQLClientInfoException(String reason, String sqlState,
  144. int vendorCode, Map<String, ClientInfoStatus> failedProperties,
  145. Throwable cause) {
  146. super(reason, sqlState, vendorCode, cause);
  147. this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
  148. }
  149. /**
  150. * Creates an SQLClientInfoException object. The Reason string is set to
  151. * reason, the SQLState string is set to the sqlState, and the Map<String,ClientInfoStatus>
  152. * object is set to the failed properties.
  153. *
  154. * @param reason
  155. * the string to use as the Reason string
  156. * @param sqlState
  157. * the string to use as the SQLState string
  158. * @param failedProperties
  159. * the Map<String,ClientInfoStatus> object to use as the
  160. * property values
  161. */
  162. public SQLClientInfoException(String reason, String sqlState,
  163. Map<String, ClientInfoStatus> failedProperties) {
  164. super(reason, sqlState);
  165. this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
  166. }
  167. /**
  168. * Creates an SQLClientInfoException object. The Reason string is set to
  169. * reason, the SQLState string is set to the sqlState, the Error Code is set
  170. * to the vendorCode, and the Map<String,ClientInfoStatus> object is set to
  171. * the failed properties.
  172. *
  173. * @param reason
  174. * the string to use as the Reason string
  175. * @param sqlState
  176. * the string to use as the SQLState string
  177. * @param failedProperties
  178. * the Map<String,ClientInfoStatus> object to use as the
  179. * property values
  180. * @param cause
  181. * the Throwable object for the underlying reason this
  182. * SQLException
  183. */
  184. public SQLClientInfoException(String reason, String sqlState,
  185. Map<String, ClientInfoStatus> failedProperties, Throwable cause) {
  186. super(reason, sqlState, cause);
  187. this.failedProperties = new HashMap<String, ClientInfoStatus>(failedProperties);
  188. }
  189. /**
  190. * returns that the client info properties which could not be set
  191. *
  192. * @return the list of ClientInfoStatus objects indicate client info
  193. * properties
  194. */
  195. public Map<String, ClientInfoStatus> getFailedProperties() {
  196. return failedProperties;
  197. }
  198. }