1 /* Copyright 2002-2005 Elliotte Rusty Harold
2 
3    This library is free software; you can redistribute it and/or modify
4    it under the terms of version 2.1 of the GNU Lesser General Public
5    License as published by the Free Software Foundation.
6 
7    This library is distributed in the hope that it will be useful,
8    but WITHOUT ANY WARRANTY; without even the implied warranty of
9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10    GNU Lesser General Public License for more details.
11 
12    You should have received a copy of the GNU Lesser General Public
13    License along with this library; if not, write to the
14    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
15    Boston, MA 02111-1307  USA
16 
17    You can contact Elliotte Rusty Harold by sending e-mail to
18    elharo@ibiblio.org. Please include the word "XOM" in the
19    subject line. The XOM home page is located at http://www.xom.nu/
20 */
21 
22 package nu.xom;
23 
24 /**
25  * <p>
26  *  Indicates an attempt to
27  *  set some value to malformed content; for instance
28  *  by adding a string containing a null or a vertical tab
29  *  to a text node, or using white space in an element name.
30  * </p>
31 
32  * @author Elliotte Rusty Harold
33  * @version 1.1b3
34  *
35  */
36 public class IllegalDataException extends WellformednessException {
37 
38     /**
39      *
40      */
41     private static final long serialVersionUID = 5116683358318890040L;
42     private String data;
43 
44 
45     /**
46      * <p>
47      * Creates a new <code>IllegalDataException</code>
48      * with a detail message.
49      * </p>
50      *
51       * @param message a string indicating the specific problem
52      */
IllegalDataException(String message)53     public IllegalDataException(String message) {
54         super(message);
55     }
56 
57 
58     /**
59      * <p>
60      * Creates a new <code>IllegalDataException</code>
61      * with a detail message and an underlying root cause.
62      * </p>
63      *
64      * @param message a string indicating the specific problem
65      * @param cause the original cause of this exception
66      */
IllegalDataException(String message, Throwable cause)67     public IllegalDataException(String message, Throwable cause) {
68         super(message, cause);
69     }
70 
71 
72     /**
73      * <p>
74      *   Stores the illegal text that caused this exception.
75      * </p>
76      *
77      * @param data the illegal data that caused this exception
78      */
setData(String data)79     public void setData(String data) {
80         this.data = data;
81     }
82 
83 
84     /**
85      * <p>
86      *   Returns a string containing the actual illegal text that
87      *   caused this exception.
88      * </p>
89      *
90      * @return the syntactically incorrect data that caused
91      *     this exception
92      */
getData()93     public String getData() {
94         return data;
95     }
96 
97 }