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