Desktop tool for browsing account info from EVE-Online
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IllegalAddException.java 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. /*--
  2. $Id: IllegalAddException.java,v 1.26 2007/11/10 05:28:59 jhunter Exp $
  3. Copyright (C) 2000-2007 Jason Hunter & Brett McLaughlin.
  4. All rights reserved.
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions
  7. are met:
  8. 1. Redistributions of source code must retain the above copyright
  9. notice, this list of conditions, and the following disclaimer.
  10. 2. Redistributions in binary form must reproduce the above copyright
  11. notice, this list of conditions, and the disclaimer that follows
  12. these conditions in the documentation and/or other materials
  13. provided with the distribution.
  14. 3. The name "JDOM" must not be used to endorse or promote products
  15. derived from this software without prior written permission. For
  16. written permission, please contact <request_AT_jdom_DOT_org>.
  17. 4. Products derived from this software may not be called "JDOM", nor
  18. may "JDOM" appear in their name, without prior written permission
  19. from the JDOM Project Management <request_AT_jdom_DOT_org>.
  20. In addition, we request (but do not require) that you include in the
  21. end-user documentation provided with the redistribution and/or in the
  22. software itself an acknowledgement equivalent to the following:
  23. "This product includes software developed by the
  24. JDOM Project (http://www.jdom.org/)."
  25. Alternatively, the acknowledgment may be graphical using the logos
  26. available at http://www.jdom.org/images/logos.
  27. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  28. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  29. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  30. DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
  31. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  32. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  33. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  34. USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  35. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  36. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  38. SUCH DAMAGE.
  39. This software consists of voluntary contributions made by many
  40. individuals on behalf of the JDOM Project and was originally
  41. created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
  42. Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information
  43. on the JDOM Project, please see <http://www.jdom.org/>.
  44. */
  45. package org.jdom;
  46. /**
  47. * Thrown when trying to add a illegal object to a JDOM construct.
  48. *
  49. * @version $Revision: 1.26 $, $Date: 2007/11/10 05:28:59 $
  50. * @author Brett McLaughlin
  51. * @author Jason Hunter
  52. */
  53. public class IllegalAddException extends IllegalArgumentException {
  54. private static final String CVS_ID =
  55. "@(#) $RCSfile: IllegalAddException.java,v $ $Revision: 1.26 $ $Date: 2007/11/10 05:28:59 $ $Name: jdom_1_1 $";
  56. /**
  57. * This will create an <code>Exception</code> indicating
  58. * that the addition of the <code>{@link Attribute}</code>
  59. * to the <code>{@link Element}</code> is illegal.
  60. *
  61. * @param base <code>Element</code> that <code>Attribute</code>
  62. * couldn't be added to
  63. * @param added <code>Attribute</code> that could not be added
  64. * @param reason cause of the problem
  65. */
  66. IllegalAddException(Element base, Attribute added, String reason) {
  67. super(new StringBuffer()
  68. .append("The attribute \"")
  69. .append(added.getQualifiedName())
  70. .append("\" could not be added to the element \"")
  71. .append(base.getQualifiedName())
  72. .append("\": ")
  73. .append(reason)
  74. .toString());
  75. }
  76. /**
  77. * This will create an <code>Exception</code> indicating
  78. * that the addition of the <code>{@link Element}</code>
  79. * to parent is illegal.
  80. *
  81. * @param base <code>Element</code> that the child
  82. * couldn't be added to
  83. * @param added <code>Element</code> that could not be added
  84. * @param reason cause of the problem
  85. */
  86. IllegalAddException(Element base, Element added, String reason) {
  87. super(new StringBuffer()
  88. .append("The element \"")
  89. .append(added.getQualifiedName())
  90. .append("\" could not be added as a child of \"")
  91. .append(base.getQualifiedName())
  92. .append("\": ")
  93. .append(reason)
  94. .toString());
  95. }
  96. /**
  97. * This will create an <code>Exception</code> indicating
  98. * that the addition of the <code>{@link Element}</code>
  99. * to the <code>{@link Document}</code> is illegal.
  100. *
  101. * @param added <code>Element</code> that could not be added
  102. * @param reason cause of the problem
  103. */
  104. IllegalAddException(Element added, String reason) {
  105. super(new StringBuffer()
  106. .append("The element \"")
  107. .append(added.getQualifiedName())
  108. .append("\" could not be added as the root of the document: ")
  109. .append(reason)
  110. .toString());
  111. }
  112. /**
  113. * This will create an <code>Exception</code> indicating
  114. * that the addition of the <code>{@link ProcessingInstruction}</code>
  115. * to the <code>{@link Element}</code> is illegal.
  116. *
  117. * @param base <code>Element</code> that the
  118. * <code>ProcessingInstruction</code> couldn't be added to
  119. * @param added <code>ProcessingInstruction</code> that could not be added
  120. * @param reason cause of the problem
  121. */
  122. IllegalAddException(Element base, ProcessingInstruction added,
  123. String reason) {
  124. super(new StringBuffer()
  125. .append("The PI \"")
  126. .append(added.getTarget())
  127. .append("\" could not be added as content to \"")
  128. .append(base.getQualifiedName())
  129. .append("\": ")
  130. .append(reason)
  131. .toString());
  132. }
  133. /**
  134. * This will create an <code>Exception</code> indicating
  135. * that the addition of the <code>{@link ProcessingInstruction}</code>
  136. * to the <code>{@link Document}</code> is illegal.
  137. *
  138. * @param added <code>ProcessingInstruction</code> that could not be added
  139. * @param reason cause of the problem
  140. */
  141. IllegalAddException(ProcessingInstruction added,
  142. String reason) {
  143. super(new StringBuffer()
  144. .append("The PI \"")
  145. .append(added.getTarget())
  146. .append("\" could not be added to the top level of the document: ")
  147. .append(reason)
  148. .toString());
  149. }
  150. /**
  151. * This will create an <code>Exception</code> indicating
  152. * that the addition of the <code>{@link Comment}</code>
  153. * to the <code>{@link Element}</code> is illegal.
  154. *
  155. * @param base <code>Element</code> that the <code>Comment</code>
  156. * couldn't be added to
  157. * @param added <code>Comment</code> that could not be added
  158. * @param reason cause of the problem
  159. */
  160. IllegalAddException(Element base, Comment added, String reason) {
  161. super(new StringBuffer()
  162. .append("The comment \"")
  163. .append(added.getText())
  164. .append("\" could not be added as content to \"")
  165. .append(base.getQualifiedName())
  166. .append("\": ")
  167. .append(reason)
  168. .toString());
  169. }
  170. /**
  171. * This will create an <code>Exception</code> indicating
  172. * that the addition of the <code>{@link CDATA}</code>
  173. *
  174. * @param base <code>Element</code> that the <code>CDATA</code>
  175. * couldn't be added to
  176. * @param added <code>CDATA</code> that could not be added
  177. * @param reason cause of the problem
  178. */
  179. IllegalAddException(Element base, CDATA added, String reason) {
  180. super(new StringBuffer()
  181. .append("The CDATA \"")
  182. .append(added.getText())
  183. .append("\" could not be added as content to \"")
  184. .append(base.getQualifiedName())
  185. .append("\": ")
  186. .append(reason)
  187. .toString());
  188. }
  189. /**
  190. * This will create an <code>Exception</code> indicating
  191. * that the addition of the <code>{@link Text}</code>
  192. * to the <code>{@link Element}</code> is illegal.
  193. *
  194. * @param base <code>Element</code> that the <code>Comment</code>
  195. * couldn't be added to
  196. * @param added <code>Text</code> that could not be added
  197. * @param reason cause of the problem
  198. */
  199. IllegalAddException(Element base, Text added, String reason) {
  200. super(new StringBuffer()
  201. .append("The Text \"")
  202. .append(added.getText())
  203. .append("\" could not be added as content to \"")
  204. .append(base.getQualifiedName())
  205. .append("\": ")
  206. .append(reason)
  207. .toString());
  208. }
  209. /**
  210. * This will create an <code>Exception</code> indicating
  211. * that the addition of the <code>{@link Comment}</code>
  212. * to the <code>{@link Document}</code> is illegal.
  213. *
  214. * @param added <code>Comment</code> that could not be added
  215. * @param reason cause of the problem
  216. */
  217. IllegalAddException(Comment added, String reason) {
  218. super(new StringBuffer()
  219. .append("The comment \"")
  220. .append(added.getText())
  221. .append("\" could not be added to the top level of the document: ")
  222. .append(reason)
  223. .toString());
  224. }
  225. /**
  226. * This will create an <code>Exception</code> indicating
  227. * that the addition of the <code>{@link EntityRef}</code>
  228. * to the <code>{@link Element}</code> is illegal.
  229. *
  230. * @param base <code>Element</code> that the <code>EntityRef</code>
  231. * couldn't be added to
  232. * @param added <code>EntityRef</code> reference that could not be added
  233. * @param reason cause of the problem
  234. */
  235. IllegalAddException(Element base, EntityRef added, String reason) {
  236. super(new StringBuffer()
  237. .append("The entity reference\"")
  238. .append(added.getName())
  239. .append("\" could not be added as content to \"")
  240. .append(base.getQualifiedName())
  241. .append("\": ")
  242. .append(reason)
  243. .toString());
  244. }
  245. /**
  246. * This will create an <code>Exception</code> indicating
  247. * that the addition of the <code>{@link Namespace}</code>
  248. * to the <code>{@link Element}</code> is illegal.
  249. *
  250. * @param base <code>Element</code> that the <code>Namespace</code>
  251. * couldn't be added to
  252. * @param added <code>Namespace</code> that could not be added
  253. * @param reason cause of the problem
  254. */
  255. IllegalAddException(Element base, Namespace added, String reason) {
  256. super(new StringBuffer()
  257. .append("The namespace xmlns")
  258. .append((added.getPrefix() == null ||
  259. added.getPrefix().equals("")) ? "="
  260. : ":" + added.getPrefix() + "=")
  261. .append("\"")
  262. .append(added.getURI())
  263. .append("\" could not be added as a namespace to \"")
  264. .append(base.getQualifiedName())
  265. .append("\": ")
  266. .append(reason)
  267. .toString());
  268. }
  269. /**
  270. * This will create an <code>Exception</code> indicating
  271. * that the addition of the <code>{@link DocType}</code>
  272. * to the <code>{@link Document}</code> is illegal.
  273. *
  274. * @param added <code>DocType</code> that could not be added
  275. * @param reason cause of the problem
  276. */
  277. IllegalAddException(DocType added, String reason) {
  278. super(new StringBuffer()
  279. .append("The DOCTYPE ")
  280. .append(added.toString())
  281. .append(" could not be added to the document: ")
  282. .append(reason)
  283. .toString());
  284. }
  285. /**
  286. * This will create an <code>Exception</code> with the specified
  287. * error message.
  288. *
  289. * @param reason cause of the problem
  290. */
  291. public IllegalAddException(String reason) {
  292. super(reason);
  293. }
  294. }