31 * This is the root exception class for all JAXB exceptions.
32 *
33 * @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li></ul>
34 * @see JAXBContext
35 * @see Marshaller
36 * @see Unmarshaller
37 * @since JAXB1.0
38 */
39 public class JAXBException extends Exception {
40
41 /**
42 * Vendor specific error code
43 *
44 */
45 private String errorCode;
46
47 /**
48 * Exception reference
49 *
50 */
51 private volatile Throwable linkedException;
52
53 static final long serialVersionUID = -5621384651494307979L;
54
55 /**
56 * Construct a JAXBException with the specified detail message. The
57 * errorCode and linkedException will default to null.
58 *
59 * @param message a description of the exception
60 */
61 public JAXBException(String message) {
62 this( message, null, null );
63 }
64
65 /**
66 * Construct a JAXBException with the specified detail message and vendor
67 * specific errorCode. The linkedException will default to null.
68 *
69 * @param message a description of the exception
70 * @param errorCode a string specifying the vendor specific error code
71 */
116 public String getErrorCode() {
117 return this.errorCode;
118 }
119
120 /**
121 * Get the linked exception
122 *
123 * @return the linked Exception, null if none exists
124 */
125 public Throwable getLinkedException() {
126 return linkedException;
127 }
128
129 /**
130 * Add a linked Exception.
131 *
132 * @param exception the linked Exception (A null value is permitted and
133 * indicates that the linked exception does not exist or
134 * is unknown).
135 */
136 public void setLinkedException( Throwable exception ) {
137 this.linkedException = exception;
138 }
139
140 /**
141 * Returns a short description of this JAXBException.
142 *
143 */
144 public String toString() {
145 return linkedException == null ?
146 super.toString() :
147 super.toString() + "\n - with linked exception:\n[" +
148 linkedException.toString()+ "]";
149 }
150
151 /**
152 * Prints this JAXBException and its stack trace (including the stack trace
153 * of the linkedException if it is non-null) to the PrintStream.
154 *
155 * @param s PrintStream to use for output
156 */
|
31 * This is the root exception class for all JAXB exceptions.
32 *
33 * @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li></ul>
34 * @see JAXBContext
35 * @see Marshaller
36 * @see Unmarshaller
37 * @since JAXB1.0
38 */
39 public class JAXBException extends Exception {
40
41 /**
42 * Vendor specific error code
43 *
44 */
45 private String errorCode;
46
47 /**
48 * Exception reference
49 *
50 */
51 private Throwable linkedException;
52
53 static final long serialVersionUID = -5621384651494307979L;
54
55 /**
56 * Construct a JAXBException with the specified detail message. The
57 * errorCode and linkedException will default to null.
58 *
59 * @param message a description of the exception
60 */
61 public JAXBException(String message) {
62 this( message, null, null );
63 }
64
65 /**
66 * Construct a JAXBException with the specified detail message and vendor
67 * specific errorCode. The linkedException will default to null.
68 *
69 * @param message a description of the exception
70 * @param errorCode a string specifying the vendor specific error code
71 */
116 public String getErrorCode() {
117 return this.errorCode;
118 }
119
120 /**
121 * Get the linked exception
122 *
123 * @return the linked Exception, null if none exists
124 */
125 public Throwable getLinkedException() {
126 return linkedException;
127 }
128
129 /**
130 * Add a linked Exception.
131 *
132 * @param exception the linked Exception (A null value is permitted and
133 * indicates that the linked exception does not exist or
134 * is unknown).
135 */
136 public synchronized void setLinkedException( Throwable exception ) {
137 this.linkedException = exception;
138 }
139
140 /**
141 * Returns a short description of this JAXBException.
142 *
143 */
144 public String toString() {
145 return linkedException == null ?
146 super.toString() :
147 super.toString() + "\n - with linked exception:\n[" +
148 linkedException.toString()+ "]";
149 }
150
151 /**
152 * Prints this JAXBException and its stack trace (including the stack trace
153 * of the linkedException if it is non-null) to the PrintStream.
154 *
155 * @param s PrintStream to use for output
156 */
|